From 97b7661cc702add0e01d361aa3bb1b51468aa5fc Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Wed, 18 Oct 2023 23:18:52 +1300 Subject: [PATCH] Fix feed channel IDs not starting with UC --- extractors/channel.py | 6 ++++-- tools/converters.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/extractors/channel.py b/extractors/channel.py index 519e3ee..a965c67 100644 --- a/extractors/channel.py +++ b/extractors/channel.py @@ -189,7 +189,9 @@ def extract_channel_latest(ucid): missing_published = False for entry in feed.findall("{http://www.w3.org/2005/Atom}entry"): id = entry.find("{http://www.youtube.com/xml/schemas/2015}videoId").text - channel_id = channel_id or entry.find("{http://www.youtube.com/xml/schemas/2015}channelId").text + video_channel_id = entry.find("{http://www.youtube.com/xml/schemas/2015}channelId").text or channel_id + if len(video_channel_id) == 22 and not video.startswith("UC"): + video_channel_id = "UC" + video_channel_id media_group = entry.find("{http://search.yahoo.com/mrss/}group") description = media_group.find("{http://search.yahoo.com/mrss/}description").text or "" media_community = media_group.find("{http://search.yahoo.com/mrss/}community") @@ -201,7 +203,7 @@ def extract_channel_latest(ucid): "title": entry.find("{http://www.w3.org/2005/Atom}title").text, "videoId": id, "author": author, - "authorId": channel_id, + "authorId": video_channel_id, "authorUrl": author_url, "videoThumbnails": generate_video_thumbnails(id), "description": description, diff --git a/tools/converters.py b/tools/converters.py index 7a96029..a2ee3ed 100644 --- a/tools/converters.py +++ b/tools/converters.py @@ -107,7 +107,7 @@ def generate_video_thumbnails(id): types = [ # quality, url part, width, height ["maxres", "maxresdefault", 1280, 720], - ["maxresdefault", "maxresdefault", 180, 720], + ["maxresdefault", "maxresdefault", 1280, 720], ["sddefault", "sddefault", 640, 480], ["high", "hqdefault", 480, 360], ["medium", "mqdefault", 320, 180],