mirror of
https://git.sr.ht/~cadence/NewLeaf
synced 2024-11-22 07:37:29 +00:00
Fix recommended extraction when fact check notice
This commit is contained in:
parent
f22decbb74
commit
65bb7a2c4c
@ -219,7 +219,11 @@ def get_more_stuff_from_file(id, result):
|
|||||||
|
|
||||||
yt_initial_data = extract_yt_initial_data(content)
|
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"]
|
views = main_video["viewCount"]["videoViewCountRenderer"]
|
||||||
result["second__viewCountText"] = get_view_count_text_or_recommended(views)
|
result["second__viewCountText"] = get_view_count_text_or_recommended(views)
|
||||||
if "shortViewCount" in views:
|
if "shortViewCount" in views:
|
||||||
@ -234,9 +238,6 @@ def get_more_stuff_from_file(id, result):
|
|||||||
recommendations = yt_initial_data["contents"]["twoColumnWatchNextResults"]["secondaryResults"]\
|
recommendations = yt_initial_data["contents"]["twoColumnWatchNextResults"]["secondaryResults"]\
|
||||||
["secondaryResults"]["results"]
|
["secondaryResults"]["results"]
|
||||||
|
|
||||||
# result = yt_initial_data
|
|
||||||
# return result
|
|
||||||
|
|
||||||
def get_useful_recommendation_data(r):
|
def get_useful_recommendation_data(r):
|
||||||
if "compactVideoRenderer" in r:
|
if "compactVideoRenderer" in r:
|
||||||
return r["compactVideoRenderer"]
|
return r["compactVideoRenderer"]
|
||||||
|
Loading…
Reference in New Issue
Block a user