mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-01-07 17:16:08 +00:00
[vk] Generalize errors
This commit is contained in:
parent
9334f8f17a
commit
e0c51cdadc
|
@ -138,13 +138,19 @@ class VKIE(InfoExtractor):
|
||||||
info_url = 'http://vk.com/al_video.php?act=show&al=1&video=%s' % video_id
|
info_url = 'http://vk.com/al_video.php?act=show&al=1&video=%s' % video_id
|
||||||
info_page = self._download_webpage(info_url, video_id)
|
info_page = self._download_webpage(info_url, video_id)
|
||||||
|
|
||||||
if re.search(r'<!>Please log in or <', info_page):
|
ERRORS = {
|
||||||
raise ExtractorError('This video is only available for registered users, '
|
r'>Видеозапись .*? была изъята из публичного доступа в связи с обращением правообладателя.<':
|
||||||
'use --username and --password options to provide account credentials.', expected=True)
|
'Video %s has been removed from public access due to rightholder complaint.',
|
||||||
|
r'<!>Please log in or <':
|
||||||
|
'Video %s is only available for registered users, '
|
||||||
|
'use --username and --password options to provide account credentials.',
|
||||||
|
'<!>Unknown error':
|
||||||
|
'Video %s does not exist.'
|
||||||
|
}
|
||||||
|
|
||||||
if '<!>Unknown error' in info_page:
|
for error_re, error_msg in ERRORS.items():
|
||||||
raise ExtractorError(
|
if re.search(error_re, info_page):
|
||||||
'Video %s does not exist' % video_id, expected=True)
|
raise ExtractorError(error_msg % video_id, expected=True)
|
||||||
|
|
||||||
m_yt = re.search(r'src="(http://www.youtube.com/.*?)"', info_page)
|
m_yt = re.search(r'src="(http://www.youtube.com/.*?)"', info_page)
|
||||||
if m_yt is not None:
|
if m_yt is not None:
|
||||||
|
|
Loading…
Reference in a new issue