[youtube] Catch more alert messages (closes #5074)
This commit is contained in:
parent
2edce52584
commit
39b62db116
1 changed files with 16 additions and 6 deletions
|
@ -1291,12 +1291,22 @@ class YoutubePlaylistIE(YoutubeBaseInfoExtractor):
|
||||||
page = self._download_webpage(url, playlist_id)
|
page = self._download_webpage(url, playlist_id)
|
||||||
more_widget_html = content_html = page
|
more_widget_html = content_html = page
|
||||||
|
|
||||||
# Check if the playlist exists or is private
|
for match in re.findall(r'<div class="yt-alert-message">([^<]+)</div>', page):
|
||||||
if re.search(r'<div class="yt-alert-message">[^<]*?(The|This) playlist (does not exist|is private)[^<]*?</div>', page) is not None:
|
match = match.strip()
|
||||||
raise ExtractorError(
|
# Check if the playlist exists or is private
|
||||||
'The playlist doesn\'t exist or is private, use --username or '
|
if re.match(r'[^<]*(The|This) playlist (does not exist|is private)[^<]*', match):
|
||||||
'--netrc to access it.',
|
raise ExtractorError(
|
||||||
expected=True)
|
'The playlist doesn\'t exist or is private, use --username or '
|
||||||
|
'--netrc to access it.',
|
||||||
|
expected=True)
|
||||||
|
elif re.match(r'[^<]*Invalid parameters[^<]*', match):
|
||||||
|
raise ExtractorError(
|
||||||
|
'Invalid parameters. Maybe URL is incorrect.',
|
||||||
|
expected=True)
|
||||||
|
elif re.match(r'[^<]*Choose your language[^<]*', match):
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
self.report_warning('Youtube gives an alert message: ' + match)
|
||||||
|
|
||||||
# Extract the video ids from the playlist pages
|
# Extract the video ids from the playlist pages
|
||||||
ids = []
|
ids = []
|
||||||
|
|
Loading…
Reference in a new issue