From 80844468f8b4cbd47e87ea91d892f924eac1a190 Mon Sep 17 00:00:00 2001 From: girst Date: Wed, 5 Jan 2022 21:51:50 +0100 Subject: [PATCH] search results: only parse first itemSectionRenderer no idea why i switched that around (no comment in eaa6b44 about it either), so reverting that. let's us remove flatten() now. --- app/common/innertube.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/common/innertube.py b/app/common/innertube.py index 13dbccb..aad2027 100644 --- a/app/common/innertube.py +++ b/app/common/innertube.py @@ -6,7 +6,6 @@ import re def listget(obj, index, fallback=None): if obj is None: return fallback return next(iter(obj[index:]), fallback) -flatten = lambda l: [item for sublist in l for item in sublist] # https://stackoverflow.com/a/952952 class G: """ @@ -64,7 +63,7 @@ def prepare_searchresults(yt_results): |G('sectionListRenderer') |G('contents') ) - items = flatten([c.get('contents',[]) for c in contents|Select(all='itemSectionRenderer')]) + items = contents|Select('itemSectionRenderer')|G('contents') items, extra = parse_result_items(items) more = contents|Select("continuationItemRenderer")|G("continuationEndpoint")|G("continuationCommand")|G("token") estimatedResults = yt_results|G("estimatedResults") -- 2.39.3