From: Sergey M․ Date: Sun, 25 Feb 2018 11:34:52 +0000 (+0700) Subject: [streamango] Capture and output error messages X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=youtube-dl;a=commitdiff_plain;h=ff274e3c16e751169e54e55955f3301ac6cb363a [streamango] Capture and output error messages --- diff --git a/youtube_dl/extractor/streamango.py b/youtube_dl/extractor/streamango.py index 08d84495a..238bba87f 100644 --- a/youtube_dl/extractor/streamango.py +++ b/youtube_dl/extractor/streamango.py @@ -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']+\bclass=["\']lead[^>]+>(.+?)

', 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 {