[youtube:playlist] Raise an error if the list doesn't exist or is private (closes...
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Thu, 1 May 2014 13:40:35 +0000 (15:40 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Thu, 1 May 2014 13:40:35 +0000 (15:40 +0200)
youtube_dl/extractor/youtube.py

index c3ae330096db379273dd5075b4cfe414d520628c..67845349eed30db5ae2f037f4791196d9137b992 100644 (file)
@@ -1436,6 +1436,13 @@ class YoutubePlaylistIE(YoutubeBaseInfoExtractor):
         page = self._download_webpage(url, playlist_id)
         more_widget_html = content_html = page
 
+        # Check if the playlist exists or is private
+        if re.search(r'<div class="yt-alert-message">[^<]*?The playlist does not exist[^<]*?</div>', page) is not None:
+            raise ExtractorError(
+                u'The playlist doesn\'t exist or is private, use --username or '
+                '--netrc to access it.',
+                expected=True)
+
         # Extract the video ids from the playlist pages
         ids = []