Explorar o código

[dailymotion] Raise ExtractorError if the dailymotion response reports an error

Jaime Marquínez Ferrándiz %!s(int64=12) %!d(string=hai) anos
pai
achega
3a1d48d6de
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      youtube_dl/extractor/dailymotion.py

+ 3 - 0
youtube_dl/extractor/dailymotion.py

@@ -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