From fc7ccb8a5c117b1fc45d072e79501e31bb584072 Mon Sep 17 00:00:00 2001 From: auouymous Date: Sat, 2 Sep 2023 02:52:55 -0600 Subject: [PATCH] Find channel ID in YouTube "watch" URLs. Prevents exception when subscribing to a channel via an URL for one of its videos. --- src/gpodder/youtube.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gpodder/youtube.py b/src/gpodder/youtube.py index 9972e079..cecd4d54 100644 --- a/src/gpodder/youtube.py +++ b/src/gpodder/youtube.py @@ -440,9 +440,9 @@ def get_channel_id_url(url, feed_data=None): else: r = feed_data # video page may contain corrupt HTML/XML, search for tag to avoid exception - m = re.search(r'channel_id=([^"]+)">', r.text) + m = re.search(r'(channel_id=([^"]+)">|"channelId":"([^"]+)")', r.text) if m: - channel_id = m.group(1) + channel_id = m.group(2) or m.group(3) else: raw_xml_data = io.BytesIO(r.content) xml_data = xml.etree.ElementTree.parse(raw_xml_data) -- 2.11.4.GIT