1
0
mirror of https://git.sr.ht/~cadence/NewLeaf synced 2024-12-22 13:06:59 +00:00

Fix recommended extraction when fact check notice

This commit is contained in:
Cadence Ember 2021-11-04 01:59:50 +13:00
parent f22decbb74
commit 65bb7a2c4c
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17

View File

@ -219,7 +219,11 @@ 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"]
# result = yt_initial_data
# return result
main_sections = yt_initial_data["contents"]["twoColumnWatchNextResults"]["results"]["results"]["contents"]
main_video = next(s["videoPrimaryInfoRenderer"] for s in main_sections if "videoPrimaryInfoRenderer" in s)
views = main_video["viewCount"]["videoViewCountRenderer"]
result["second__viewCountText"] = get_view_count_text_or_recommended(views)
if "shortViewCount" in views:
@ -234,9 +238,6 @@ def get_more_stuff_from_file(id, result):
recommendations = yt_initial_data["contents"]["twoColumnWatchNextResults"]["secondaryResults"]\
["secondaryResults"]["results"]
# result = yt_initial_data
# return result
def get_useful_recommendation_data(r):
if "compactVideoRenderer" in r:
return r["compactVideoRenderer"]