[dailymotion] Raise ExtractorError if the dailymotion response reports an error
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sat, 21 Sep 2013 10:15:54 +0000 (12:15 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sat, 21 Sep 2013 10:15:54 +0000 (12:15 +0200)
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