]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/vshare.py
3 from .common
import InfoExtractor
4 from ..compat
import compat_chr
11 class VShareIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?vshare\.io/[dv]/(?P<id>[^/?#&]+)'
14 'url': 'https://vshare.io/d/0f64ce6',
15 'md5': '17b39f55b5497ae8b59f5fbce8e35886',
18 'title': 'vl14062007715967',
22 'url': 'https://vshare.io/v/0f64ce6/width-650/height-430/1',
23 'only_matching': True,
27 def _extract_urls(webpage
):
29 r
'<iframe[^>]+?src=["\'](?P
<url
>(?
:https?
:)?
//(?
:www\
.)?vshare\
.io
/v
/[^
/?
#&]+)',
32 def _extract_packed(self
, webpage
):
33 packed
= self
._search
_regex
(
34 r
'(eval\(function.+)', webpage
, 'packed code')
35 unpacked
= decode_packed_codes(packed
)
36 digits
= self
._search
_regex
(r
'\[((?:\d+,?)+)\]', unpacked
, 'digits')
37 digits
= [int(digit
) for digit
in digits
.split(',')]
38 key_digit
= self
._search
_regex
(
39 r
'fromCharCode\(.+?(\d+)\)}', unpacked
, 'key digit')
40 chars
= [compat_chr(d
- int(key_digit
)) for d
in digits
]
43 def _real_extract(self
, url
):
44 video_id
= self
._match
_id
(url
)
46 webpage
= self
._download
_webpage
(
47 'https://vshare.io/v/%s/width-650/height-430/1' % video_id
,
48 video_id
, headers
={'Referer': url}
)
50 title
= self
._html
_extract
_title
(webpage
)
51 title
= title
.split(' - ')[0]
53 error
= self
._html
_search
_regex
(
54 r
'(?s)<div[^>]+\bclass=["\']xxx
-error
[^
>]+>(.+?
)</div
', webpage,
55 'error
', default=None)
57 raise ExtractorError(error, expected=True)
59 info = self._parse_html5_media_entries(
60 url, '<video
>%s</video
>' % self._extract_packed(webpage),
63 self._sort_formats(info['formats
'])