~cadence/tube-devel

NewLeaf: Fix recommended videos extraction for COVID-related videos v1 SUPERSEDED

~lomanic: 1
 Fix recommended videos extraction for COVID-related videos

 1 files changed, 6 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~cadence/tube-devel/patches/26121/mbox | git am -3
Learn more about email & git

[PATCH NewLeaf] Fix recommended videos extraction for COVID-related videos Export this patch

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..b29818d 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 content in yt_initial_data["contents"]["twoColumnWatchNextResults"]["results"]["results"]["contents"]:
					if content.get("videoPrimaryInfoRenderer", False):
						main_video = content["videoPrimaryInfoRenderer"]

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