~cadence/tube-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH NewLeaf] Fix search extractor wrongly filtering ads sections against now removed property

~lomanic
Details
Message ID
<162086719517.6313.13448529725706616858-0@git.sr.ht>
DKIM signature
missing
Download raw message
Patch: +5 -3
From: Lomanic <lomanic@hotmail.fr>

The ads sections had a carouselAdRenderer property, now they have a
promotedSparklesTextSearchRenderer property instead.
As this may change again in the future, we should just get all items
as we discriminate/filter them as videos afterwards with the
videoRenderer property.
---
 extractors/search.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/extractors/search.py b/extractors/search.py
index aeb891c..f354278 100644
--- a/extractors/search.py
+++ b/extractors/search.py
@@ -22,9 +22,11 @@ def extract_search(q):
			content = r.content.decode("utf8")
			yt_initial_data = extract_yt_initial_data(content)
			sections = yt_initial_data["contents"]["twoColumnSearchResultsRenderer"]["primaryContents"]["sectionListRenderer"]["contents"]
			# find the section with the videos, not the one with the ads
			section = next(s for s in sections if "itemSectionRenderer" in s and not (len(s["itemSectionRenderer"]["contents"]) >= 1 and "carouselAdRenderer" in s["itemSectionRenderer"]["contents"][0]))
			items = section["itemSectionRenderer"]["contents"]
			# get all items as we filter videoRenderer entries afterwards
			items = []
			itemSections = [s for s in sections if "itemSectionRenderer" in s]
			for section in itemSections:
				items += section["itemSectionRenderer"]["contents"]
			results = []
			for item in items:
				if "videoRenderer" in item:
-- 
2.30.2
Details
Message ID
<20210514184834.e80c113a915e9f3e2b5cdd4d@disroot.org>
In-Reply-To
<162086719517.6313.13448529725706616858-0@git.sr.ht> (view parent)
DKIM signature
pass
Download raw message
Seems good, thank you so much!
Reply to thread Export thread (mbox)