mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-13 18:51:03 +01:00
[vshare] Capture and output error message
This commit is contained in:
parent
0987f2ddb2
commit
ff31f2d5c3
@ -5,7 +5,10 @@
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import compat_chr
|
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 @@ def _real_extract(self, url):
|
|||||||
title = self._html_search_regex(r'<title>([^<]+)</title>', webpage, 'title')
|
title = self._html_search_regex(r'<title>([^<]+)</title>', webpage, 'title')
|
||||||
title = title.split(' - ')[0]
|
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)
|
unpacked = self._extract_packed(webpage)
|
||||||
video_urls = re.findall(r'<source src="([^"]+)', unpacked)
|
video_urls = re.findall(r'<source src="([^"]+)', unpacked)
|
||||||
formats = [{'url': video_url} for video_url in video_urls]
|
formats = [{'url': video_url} for video_url in video_urls]
|
||||||
|
Loading…
Reference in New Issue
Block a user