diff options
author | Sergey M․ <[email protected]> | 2017-11-14 22:39:54 +0700 |
---|---|---|
committer | Sergey M․ <[email protected]> | 2017-11-14 22:39:54 +0700 |
commit | ff31f2d5c3750364b013a9bf59b85cebd0cee1fd (patch) | |
tree | b12b0195d1574a06421fb62df8916b3ac2197f48 | |
parent | 0987f2ddb27a27506c697ad9dae2ccbf24fc786d (diff) | |
download | youtube-dl-ff31f2d5c3750364b013a9bf59b85cebd0cee1fd.tar.gz youtube-dl-ff31f2d5c3750364b013a9bf59b85cebd0cee1fd.zip |
[vshare] Capture and output error message
-rw-r--r-- | youtube_dl/extractor/vshare.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/youtube_dl/extractor/vshare.py b/youtube_dl/extractor/vshare.py index ea39a9051..20ce22e16 100644 --- a/youtube_dl/extractor/vshare.py +++ b/youtube_dl/extractor/vshare.py @@ -5,7 +5,10 @@ import re from .common import InfoExtractor from ..compat import compat_chr -from ..utils import decode_packed_codes +from ..utils import ( + decode_packed_codes, + ExtractorError, +) class VShareIE(InfoExtractor): @@ -42,6 +45,12 @@ class VShareIE(InfoExtractor): title = self._html_search_regex(r'<title>([^<]+)</title>', webpage, 'title') title = title.split(' - ')[0] + error = self._html_search_regex( + r'(?s)<div[^>]+\bclass=["\']xxx-error[^>]+>(.+?)</div', webpage, + 'error', default=None) + if error: + raise ExtractorError(error, expected=True) + unpacked = self._extract_packed(webpage) video_urls = re.findall(r'<source src="([^"]+)', unpacked) formats = [{'url': video_url} for video_url in video_urls] |