projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0987f2d
)
[vshare] Capture and output error message
author
Sergey M․
<dstftw@gmail.com>
Tue, 14 Nov 2017 15:39:54 +0000
(22:39 +0700)
committer
Sergey M․
<dstftw@gmail.com>
Tue, 14 Nov 2017 15:39:54 +0000
(22:39 +0700)
youtube_dl/extractor/vshare.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/vshare.py
b/youtube_dl/extractor/vshare.py
index ea39a9051ebf8531113f24a8f7fb96d13d080a40..20ce22e16203ffc96e04d0e88ff727cda4ee5f81 100644
(file)
--- 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 .common import InfoExtractor
from ..compat import compat_chr
-from ..utils import decode_packed_codes
+from ..utils import (
+ decode_packed_codes,
+ ExtractorError,
+)
class VShareIE(InfoExtractor):
class VShareIE(InfoExtractor):
@@
-42,6
+45,12
@@
class VShareIE(InfoExtractor):
title = self._html_search_regex(r'<title>([^<]+)</title>', webpage, 'title')
title = title.split(' - ')[0]
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]
unpacked = self._extract_packed(webpage)
video_urls = re.findall(r'<source src="([^"]+)', unpacked)
formats = [{'url': video_url} for video_url in video_urls]