]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[streamango] Capture and output error messages
authorSergey M․ <dstftw@gmail.com>
Sun, 25 Feb 2018 11:34:52 +0000 (18:34 +0700)
committerSergey M․ <dstftw@gmail.com>
Sun, 25 Feb 2018 11:34:52 +0000 (18:34 +0700)
youtube_dl/extractor/streamango.py

index 08d84495ae8b74d56857a2202e61dddd3e085cb2..238bba87f1aae2e28ef7ce60ac1531be06b553eb 100644 (file)
@@ -7,6 +7,7 @@ from .common import InfoExtractor
 from ..compat import compat_chr
 from ..utils import (
     determine_ext,
+    ExtractorError,
     int_or_none,
     js_to_json,
 )
@@ -100,6 +101,16 @@ class StreamangoIE(InfoExtractor):
                     'height': int_or_none(video.get('height')),
                     'tbr': int_or_none(video.get('bitrate')),
                 })
+
+        if not formats:
+            error = self._search_regex(
+                r'<p[^>]+\bclass=["\']lead[^>]+>(.+?)</p>', webpage,
+                'error', default=None)
+            if not error and '>Sorry' in webpage:
+                error = 'Video %s is not available' % video_id
+            if error:
+                raise ExtractorError(error, expected=True)
+
         self._sort_formats(formats)
 
         return {