Explorar o código

[tvigle] Capture error message

Sergey M․ %!s(int64=10) %!d(string=hai) anos
pai
achega
15b74b94be
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      youtube_dl/extractor/tvigle.py

+ 8 - 0
youtube_dl/extractor/tvigle.py

@@ -5,6 +5,7 @@ import re
 
 from .common import InfoExtractor
 from ..utils import (
+    ExtractorError,
     float_or_none,
     int_or_none,
     parse_age_limit,
@@ -63,6 +64,13 @@ class TvigleIE(InfoExtractor):
 
         item = video_data['playlist']['items'][0]
 
+        videos = item.get('videos')
+
+        error_message = item.get('errorMessage')
+        if not videos and error_message:
+            raise ExtractorError(
+                '%s returned error: %s' % (self.IE_NAME, error_message), expected=True)
+
         title = item['title']
         description = item.get('description')
         thumbnail = item.get('thumbnail')