소스 검색

[yandexmusic] Improve error handling

Sergey M․ 9 년 전
부모
커밋
eebe6b382e
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      youtube_dl/extractor/yandexmusic.py

+ 4 - 3
youtube_dl/extractor/yandexmusic.py

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