]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[youtube:channel] Correct 404 handling
authorPhilipp Hagemeister <phihag@phihag.de>
Sun, 13 Sep 2015 22:32:20 +0000 (00:32 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Sun, 13 Sep 2015 22:32:20 +0000 (00:32 +0200)
Previously, when we encountered a 404 - such as youtube-dl https://www.youtube.com/ohJeiboh8oorehai - we crashed with a regexp error. Instead, make sure to go on and eventually report a 404.

youtube_dl/extractor/youtube.py

index abacdfaed17e83f3311d8e18e660f154c3653468..b252e36e1162406dedfcc531d7d038e6bd357348 100644 (file)
@@ -1654,12 +1654,15 @@ class YoutubeChannelIE(InfoExtractor):
         channel_page = self._download_webpage(
             url + '?view=57', channel_id,
             'Downloading channel page', fatal=False)
-        channel_playlist_id = self._html_search_meta(
-            'channelId', channel_page, 'channel id', default=None)
-        if not channel_playlist_id:
-            channel_playlist_id = self._search_regex(
-                r'data-channel-external-id="([^"]+)"',
-                channel_page, 'channel id', default=None)
+        if channel_page is False:
+            channel_playlist_id = False
+        else:
+            channel_playlist_id = self._html_search_meta(
+                'channelId', channel_page, 'channel id', default=None)
+            if not channel_playlist_id:
+                channel_playlist_id = self._search_regex(
+                    r'data-channel-external-id="([^"]+)"',
+                    channel_page, 'channel id', default=None)
         if channel_playlist_id and channel_playlist_id.startswith('UC'):
             playlist_id = 'UU' + channel_playlist_id[2:]
             return self.url_result(