mirror of https://github.com/yt-dlp/yt-dlp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.1 KiB
Python
66 lines
2.1 KiB
Python
8 years ago
|
import re
|
||
|
|
||
8 years ago
|
from .common import InfoExtractor
|
||
9 years ago
|
from ..utils import (
|
||
9 years ago
|
decode_packed_codes,
|
||
9 years ago
|
js_to_json,
|
||
8 years ago
|
NO_DEFAULT,
|
||
|
PACKED_CODES_RE,
|
||
9 years ago
|
)
|
||
10 years ago
|
|
||
9 years ago
|
|
||
8 years ago
|
class VidziIE(InfoExtractor):
|
||
6 years ago
|
_VALID_URL = r'https?://(?:www\.)?vidzi\.(?:tv|cc|si|nu)/(?:embed-)?(?P<id>[0-9a-zA-Z]+)'
|
||
8 years ago
|
_TESTS = [{
|
||
10 years ago
|
'url': 'http://vidzi.tv/cghql9yq6emu.html',
|
||
|
'md5': '4f16c71ca0c8c8635ab6932b5f3f1660',
|
||
10 years ago
|
'info_dict': {
|
||
10 years ago
|
'id': 'cghql9yq6emu',
|
||
10 years ago
|
'ext': 'mp4',
|
||
4 years ago
|
'title': 'youtube-dl test video 1\\\\2\'3/4<5\\\\6ä7↭',
|
||
9 years ago
|
},
|
||
|
'params': {
|
||
|
# m3u8 download
|
||
|
'skip_download': True,
|
||
10 years ago
|
},
|
||
8 years ago
|
}, {
|
||
|
'url': 'http://vidzi.tv/embed-4z2yb0rzphe9-600x338.html',
|
||
7 years ago
|
'only_matching': True,
|
||
8 years ago
|
}, {
|
||
|
'url': 'http://vidzi.cc/cghql9yq6emu.html',
|
||
7 years ago
|
'only_matching': True,
|
||
7 years ago
|
}, {
|
||
|
'url': 'https://vidzi.si/rph9gztxj1et.html',
|
||
|
'only_matching': True,
|
||
6 years ago
|
}, {
|
||
|
'url': 'http://vidzi.nu/cghql9yq6emu.html',
|
||
|
'only_matching': True,
|
||
8 years ago
|
}]
|
||
10 years ago
|
|
||
|
def _real_extract(self, url):
|
||
10 years ago
|
video_id = self._match_id(url)
|
||
10 years ago
|
|
||
8 years ago
|
webpage = self._download_webpage(
|
||
|
'http://vidzi.tv/%s' % video_id, video_id)
|
||
10 years ago
|
title = self._html_search_regex(
|
||
10 years ago
|
r'(?s)<h2 class="video-title">(.*?)</h2>', webpage, 'title')
|
||
10 years ago
|
|
||
8 years ago
|
codes = [webpage]
|
||
|
codes.extend([
|
||
|
decode_packed_codes(mobj.group(0)).replace('\\\'', '\'')
|
||
|
for mobj in re.finditer(PACKED_CODES_RE, webpage)])
|
||
|
for num, code in enumerate(codes, 1):
|
||
8 years ago
|
jwplayer_data = self._parse_json(
|
||
|
self._search_regex(
|
||
|
r'setup\(([^)]+)\)', code, 'jwplayer data',
|
||
8 years ago
|
default=NO_DEFAULT if num == len(codes) else '{}'),
|
||
7 years ago
|
video_id, transform_source=lambda s: js_to_json(
|
||
|
re.sub(r'\s*\+\s*window\[.+?\]', '', s)))
|
||
8 years ago
|
if jwplayer_data:
|
||
|
break
|
||
9 years ago
|
|
||
|
info_dict = self._parse_jwplayer_data(jwplayer_data, video_id, require_title=False)
|
||
|
info_dict['title'] = title
|
||
|
|
||
|
return info_dict
|