mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[youtube] raise ExtractorError when no data available(#20737)
This commit is contained in:
parent
e09965d550
commit
15be3eb5e5
1 changed files with 7 additions and 0 deletions
|
@ -1671,6 +1671,13 @@ def extract_unavailable_message():
|
||||||
r'(?s)<h1[^>]+id="unavailable-message"[^>]*>(.+?)</h1>',
|
r'(?s)<h1[^>]+id="unavailable-message"[^>]*>(.+?)</h1>',
|
||||||
video_webpage, 'unavailable message', default=None)
|
video_webpage, 'unavailable message', default=None)
|
||||||
|
|
||||||
|
if not video_info:
|
||||||
|
unavailable_message = extract_unavailable_message()
|
||||||
|
if not unavailable_message:
|
||||||
|
unavailable_message = 'Unable to extract video data'
|
||||||
|
raise ExtractorError(
|
||||||
|
'YouTube said: %s' % unavailable_message, expected=True, video_id=video_id)
|
||||||
|
|
||||||
if 'token' not in video_info:
|
if 'token' not in video_info:
|
||||||
if 'reason' in video_info:
|
if 'reason' in video_info:
|
||||||
if 'The uploader has not made this video available in your country.' in video_info['reason']:
|
if 'The uploader has not made this video available in your country.' in video_info['reason']:
|
||||||
|
|
Loading…
Reference in a new issue