[flickr] handle error message
authorremitamine <remitamine@gmail.com>
Sun, 1 Nov 2015 12:38:11 +0000 (13:38 +0100)
committerremitamine <remitamine@gmail.com>
Sun, 1 Nov 2015 12:38:11 +0000 (13:38 +0100)
youtube_dl/extractor/flickr.py

index 0d5d6b0b9a7e5165952f64c4557c2df57d26f7ee..e97754d36e734da8cdb4be23fe7b225d8d4b86d1 100644 (file)
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
 from .common import InfoExtractor
 from ..compat import compat_urllib_parse
 from ..utils import (
+    ExtractorError,
     int_or_none,
     qualities,
 )
@@ -39,7 +40,10 @@ class FlickrIE(InfoExtractor):
         }
         if secret:
             query['secret'] = secret
-        return self._download_json(self._API_BASE_URL + compat_urllib_parse.urlencode(query), video_id, note)
+        data = self._download_json(self._API_BASE_URL + compat_urllib_parse.urlencode(query), video_id, note)
+        if data['stat'] != 'ok':
+            raise ExtractorError(data['message'])
+        return data
 
     def _real_extract(self, url):
         video_id = self._match_id(url)