YouTube feeds no longer contain the required 'UC' prefix on channel ID.

Which produces a broken channel URL, and missing description. New
channels will also be missing a thumbnail.

This checks for 22 character IDs and prepends 'UC' to form a valid ID.
Updating all channels with this patch will fix all of the above issues.
This commit is contained in:
auouymous 2023-11-18 23:56:18 -07:00
parent b8339b8d73
commit 78ea372894
1 changed files with 4 additions and 0 deletions

View File

@ -454,6 +454,10 @@ def get_channel_id_url(url, feed_data=None):
channel_id = m.group(1)
if channel_id is None:
raise Exception('Could not retrieve YouTube channel ID for URL %s.' % url)
# feeds no longer contain the required "UC" prefix on channel ID
if len(channel_id) == 22:
channel_id = "UC" + channel_id
channel_url = 'https://www.youtube.com/channel/{}'.format(channel_id)
return channel_url