[yandexmusic] Improve error handling
authorSergey M․ <dstftw@gmail.com>
Thu, 28 Apr 2016 15:37:34 +0000 (21:37 +0600)
committerSergey M․ <dstftw@gmail.com>
Thu, 28 Apr 2016 15:37:34 +0000 (21:37 +0600)
youtube_dl/extractor/yandexmusic.py

index 0d32a612fb60064251137550e608e28b3c198d52..b0e68a0879e5d13fb91d3e240d8285795d3c8017 100644 (file)
@@ -18,9 +18,10 @@ from ..utils import (
 class YandexMusicBaseIE(InfoExtractor):
     @staticmethod
     def _handle_error(response):
-        error = response.get('error')
-        if error:
-            raise ExtractorError(error, expected=True)
+        if isinstance(response, dict):
+            error = response.get('error')
+            if error:
+                raise ExtractorError(error, expected=True)
 
     def _download_webpage(self, *args, **kwargs):
         webpage = super(YandexMusicBaseIE, self)._download_webpage(*args, **kwargs)