mirror of
https://git.sr.ht/~cadence/NewLeaf
synced 2024-11-14 12:07:30 +00:00
Touch up Bopol's patch
This commit is contained in:
parent
6cc921c2dc
commit
f1ddf66f50
@ -22,7 +22,7 @@ def extract_channel(ucid):
|
|||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
yt_initial_data = extract_yt_initial_data(r.content.decode("utf8"))
|
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"]
|
channel_metadata = yt_initial_data["metadata"]["channelMetadataRenderer"]
|
||||||
|
|
||||||
if header:
|
if header:
|
||||||
@ -45,10 +45,9 @@ def extract_channel(ucid):
|
|||||||
t["url"] = normalise_url_protocol(t["url"])
|
t["url"] = normalise_url_protocol(t["url"])
|
||||||
|
|
||||||
author_thumbnails = []
|
author_thumbnails = []
|
||||||
if "avatar" in header:
|
avatar = header.get("avatar") or channel_metadata.get("avatar")
|
||||||
author_thumbnails = generate_full_author_thumbnails(header["avatar"]["thumbnails"])
|
if avatar:
|
||||||
elif "avatar" in channel_metadata:
|
author_thumbnails = generate_full_author_thumbnails(avatar["thumbnails"])
|
||||||
author_thumbnails = generate_full_author_thumbnails(channel_metadata["avatar"]["thumbnails"])
|
|
||||||
|
|
||||||
latest_videos = []
|
latest_videos = []
|
||||||
tabs = yt_initial_data["contents"]["twoColumnBrowseResultsRenderer"]["tabs"]
|
tabs = yt_initial_data["contents"]["twoColumnBrowseResultsRenderer"]["tabs"]
|
||||||
|
Loading…
Reference in New Issue
Block a user