diff options
author | Sergey M․ <[email protected]> | 2016-06-20 22:40:22 +0700 |
---|---|---|
committer | Sergey M․ <[email protected]> | 2016-06-20 22:40:22 +0700 |
commit | feef925f49c80fc125ff24f61a144af902a648d2 (patch) | |
tree | 8efaca9fc6ffefb8f4de1072d17b32fdf14ff2ba | |
parent | 19e2d1cdeaf36805d72206a6309a6f7421f3c9ed (diff) | |
download | youtube-dl-feef925f49c80fc125ff24f61a144af902a648d2.tar.gz youtube-dl-feef925f49c80fc125ff24f61a144af902a648d2.zip |
[streamcloud] Capture error message (#9840)
-rw-r--r-- | youtube_dl/extractor/streamcloud.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/youtube_dl/extractor/streamcloud.py b/youtube_dl/extractor/streamcloud.py index 58560ec64..6a6bb90c4 100644 --- a/youtube_dl/extractor/streamcloud.py +++ b/youtube_dl/extractor/streamcloud.py @@ -6,7 +6,6 @@ import re from .common import InfoExtractor from ..utils import ( ExtractorError, - sanitized_Request, urlencode_postdata, ) @@ -45,20 +44,26 @@ class StreamcloudIE(InfoExtractor): (?:id="[^"]+"\s+)? value="([^"]*)" ''', orig_webpage) - post = urlencode_postdata(fields) self._sleep(12, video_id) - headers = { - b'Content-Type': b'application/x-www-form-urlencoded', - } - req = sanitized_Request(url, post, headers) webpage = self._download_webpage( - req, video_id, note='Downloading video page ...') - title = self._html_search_regex( - r'<h1[^>]*>([^<]+)<', webpage, 'title') - video_url = self._search_regex( - r'file:\s*"([^"]+)"', webpage, 'video URL') + url, video_id, data=urlencode_postdata(fields), headers={ + b'Content-Type': b'application/x-www-form-urlencoded', + }) + + try: + title = self._html_search_regex( + r'<h1[^>]*>([^<]+)<', webpage, 'title') + video_url = self._search_regex( + r'file:\s*"([^"]+)"', webpage, 'video URL') + except ExtractorError: + message = self._html_search_regex( + r'(?s)<div[^>]+class=(["\']).*?msgboxinfo.*?\1[^>]*>(?P<message>.+?)</div>', + webpage, 'message', default=None, group='message') + if message: + raise ExtractorError('%s said: %s' % (self.IE_NAME, message), expected=True) + raise thumbnail = self._search_regex( r'image:\s*"([^"]+)"', webpage, 'thumbnail URL', fatal=False) |