Explorar o código

[wat] Capture and output error message

Sergey M․ %!s(int64=11) %!d(string=hai) anos
pai
achega
86916dae4b
Modificáronse 1 ficheiros con 9 adicións e 1 borrados
  1. 9 1
      youtube_dl/extractor/wat.py

+ 9 - 1
youtube_dl/extractor/wat.py

@@ -5,7 +5,10 @@ import re
 import hashlib
 
 from .common import InfoExtractor
-from ..utils import unified_strdate
+from ..utils import (
+    ExtractorError,
+    unified_strdate,
+)
 
 
 class WatIE(InfoExtractor):
@@ -57,6 +60,11 @@ class WatIE(InfoExtractor):
 
         video_info = self.download_video_info(real_id)
 
+        error_desc = video_info.get('error_desc')
+        if error_desc:
+            raise ExtractorError(
+                '%s returned error: %s' % (self.IE_NAME, error_desc), expected=True)
+
         geo_list = video_info.get('geoList')
         country = geo_list[0] if geo_list else ''