[dailymotion] Raise ExtractorError if the dailymotion response reports an error
[youtube-dl] / youtube_dl / extractor / dailymotion.py
index 360113f9c46840ad4e0f38a8cc9974f36d6a25c5..ce7057a260e4e2212db23e90fd0dacd77aa815b3 100644 (file)
@@ -63,6 +63,9 @@ class DailymotionIE(SubtitlesInfoExtractor):
         info = self._search_regex(r'var info = ({.*?}),$', embed_page,
             'video info', flags=re.MULTILINE)
         info = json.loads(info)
+        if info.get('error') is not None:
+            msg = 'Couldn\'t get video, Dailymotion says: %s' % info['error']['title']
+            raise ExtractorError(msg, expected=True)
 
         # TODO: support choosing qualities