aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/youtube.py
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2019-04-22 20:31:09 +0100
committerRemita Amine <remitamine@gmail.com>2019-04-22 20:52:43 +0100
commit15be3eb5e526c232a36f5f73fd5e586572b06fc5 (patch)
treed48245977c346fe39ef1139a38e895798c0603f5 /youtube_dl/extractor/youtube.py
parente09965d550d8d76ea0c616cbb58800ee2249f15c (diff)
[youtube] raise ExtractorError when no data available(#20737)
Diffstat (limited to 'youtube_dl/extractor/youtube.py')
-rw-r--r--youtube_dl/extractor/youtube.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 132572c88..67eceb5c4 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -1671,6 +1671,13 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
r'(?s)<h1[^>]+id="unavailable-message"[^>]*>(.+?)</h1>',
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 'reason' in video_info:
if 'The uploader has not made this video available in your country.' in video_info['reason']: