소스 검색

[youtube:playlist] Raise an error if the list doesn't exist or is private (closes #2840)

Jaime Marquínez Ferrándiz 11 년 전
부모
커밋
10c0e2d818
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      youtube_dl/extractor/youtube.py

+ 7 - 0
youtube_dl/extractor/youtube.py

@@ -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 = []