~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 v2] Fix recommended videos extraction for COVID-related videos

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

---
 extractors/video.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/extractors/video.py b/extractors/video.py
index fe23de7..dfbde0e 100644
--- a/extractors/video.py
+++ b/extractors/video.py
@@ -219,7 +219,12 @@ def get_more_stuff_from_file(id, result):

				yt_initial_data = extract_yt_initial_data(content)

				main_video = yt_initial_data["contents"]["twoColumnWatchNextResults"]["results"]["results"]["contents"][0]["videoPrimaryInfoRenderer"]
				# for some topics like COVID, the first "contents" element is not the one we are interested in
				# but an "Information panel giving topical context" https://support.google.com/youtube/answer/9004474
				for c in yt_initial_data["contents"]["twoColumnWatchNextResults"]["results"]["results"]["contents"]:
					if c.get("videoPrimaryInfoRenderer", False):
						main_video = c["videoPrimaryInfoRenderer"]

				views = main_video["viewCount"]["videoViewCountRenderer"]
				result["second__viewCountText"] = get_view_count_text_or_recommended(views)
				if "shortViewCount" in views:
-- 
2.32.0

Re: [PATCH NewLeaf v2] Fix recommended videos extraction for COVID-related videos

Details
Message ID
<20211104020124.2291bbd6d69c2bc22266cd51@disroot.org>
In-Reply-To
<163579603024.22931.3367037757943342294-0@git.sr.ht> (view parent)
DKIM signature
pass
Download raw message
Thanks for the heads up! I committed some code I wrote with the same
effect that I think is cleaner.
Reply to thread Export thread (mbox)