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

Touch up Bopol's patch

This commit is contained in:
Cadence Ember 2021-01-17 14:55:57 +13:00
parent 6cc921c2dc
commit f1ddf66f50
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17

View File

@ -22,7 +22,7 @@ def extract_channel(ucid):
r.raise_for_status()
yt_initial_data = extract_yt_initial_data(r.content.decode("utf8"))
header = yt_initial_data["header"]["c4TabbedHeaderRenderer"] if "c4TabbedHeaderRenderer" in yt_initial_data["header"] else []
header = yt_initial_data["header"]["c4TabbedHeaderRenderer"] if "c4TabbedHeaderRenderer" in yt_initial_data["header"] else {}
channel_metadata = yt_initial_data["metadata"]["channelMetadataRenderer"]
if header:
@ -45,10 +45,9 @@ def extract_channel(ucid):
t["url"] = normalise_url_protocol(t["url"])
author_thumbnails = []
if "avatar" in header:
author_thumbnails = generate_full_author_thumbnails(header["avatar"]["thumbnails"])
elif "avatar" in channel_metadata:
author_thumbnails = generate_full_author_thumbnails(channel_metadata["avatar"]["thumbnails"])
avatar = header.get("avatar") or channel_metadata.get("avatar")
if avatar:
author_thumbnails = generate_full_author_thumbnails(avatar["thumbnails"])
latest_videos = []
tabs = yt_initial_data["contents"]["twoColumnBrowseResultsRenderer"]["tabs"]