Compare commits

..

No commits in common. "74f8cc48afa59e1a125f939c060b21654d29789c" and "266b6ef18520f8de60fa143e154e4b12be12afb7" have entirely different histories.

View File

@ -12,7 +12,6 @@ from ..utils import (
mimetype2ext, mimetype2ext,
parse_codecs, parse_codecs,
update_url_query, update_url_query,
urljoin,
xpath_element, xpath_element,
xpath_text, xpath_text,
) )
@ -20,7 +19,6 @@ from ..compat import (
compat_b64decode, compat_b64decode,
compat_ord, compat_ord,
compat_struct_pack, compat_struct_pack,
compat_urlparse,
) )
@ -47,24 +45,10 @@ class VideaIE(InfoExtractor):
}, },
}, { }, {
'url': 'http://videa.hu/videok/origo/jarmuvek/supercars-elozes-jAHDWfWSJH5XuFhH', 'url': 'http://videa.hu/videok/origo/jarmuvek/supercars-elozes-jAHDWfWSJH5XuFhH',
'md5': 'd57ccd8812c7fd491d33b1eab8c99975', 'only_matching': True,
'info_dict': {
'id': 'jAHDWfWSJH5XuFhH',
'ext': 'mp4',
'title': 'Supercars előzés',
'thumbnail': r're:^https?://.*',
'duration': 64,
},
}, { }, {
'url': 'http://videa.hu/player?v=8YfIAjxwWGwT8HVQ', 'url': 'http://videa.hu/player?v=8YfIAjxwWGwT8HVQ',
'md5': '97a7af41faeaffd9f1fc864a7c7e7603', 'only_matching': True,
'info_dict': {
'id': '8YfIAjxwWGwT8HVQ',
'ext': 'mp4',
'title': 'Az őrült kígyász 285 kígyót enged szabadon',
'thumbnail': r're:^https?://.*',
'duration': 21,
},
}, { }, {
'url': 'http://videa.hu/player/v/8YfIAjxwWGwT8HVQ?autoplay=1', 'url': 'http://videa.hu/player/v/8YfIAjxwWGwT8HVQ?autoplay=1',
'only_matching': True, 'only_matching': True,
@ -107,20 +91,13 @@ class VideaIE(InfoExtractor):
k = S[(S[i] + S[j]) % 256] k = S[(S[i] + S[j]) % 256]
res += compat_struct_pack('B', k ^ compat_ord(cipher_text[m])) res += compat_struct_pack('B', k ^ compat_ord(cipher_text[m]))
return res.decode('utf-8') return res.decode()
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
video_page = self._download_webpage(url, video_id) query = {'v': video_id}
player_page = self._download_webpage(
if 'videa.hu/player' in url: 'https://videa.hu/player', video_id, query=query)
player_url = url
player_page = video_page
else:
player_url = self._search_regex(
r'<iframe.*?src="(/player\?[^"]+)"', video_page, 'player url')
player_url = urljoin(url, player_url)
player_page = self._download_webpage(player_url, video_id)
nonce = self._search_regex( nonce = self._search_regex(
r'_xt\s*=\s*"([^"]+)"', player_page, 'nonce') r'_xt\s*=\s*"([^"]+)"', player_page, 'nonce')
@ -130,7 +107,6 @@ class VideaIE(InfoExtractor):
for i in range(0, 32): for i in range(0, 32):
result += s[i - (self._STATIC_SECRET.index(l[i]) - 31)] result += s[i - (self._STATIC_SECRET.index(l[i]) - 31)]
query = compat_urlparse.parse_qs(compat_urlparse.urlparse(player_url).query)
random_seed = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(8)) random_seed = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(8))
query['_s'] = random_seed query['_s'] = random_seed
query['_t'] = result[:16] query['_t'] = result[:16]
@ -145,13 +121,13 @@ class VideaIE(InfoExtractor):
compat_b64decode(b64_info), key), video_id) compat_b64decode(b64_info), key), video_id)
video = xpath_element(info, './video', 'video') video = xpath_element(info, './video', 'video')
if video is None: if not video:
raise ExtractorError(xpath_element( raise ExtractorError(xpath_element(
info, './error', fatal=True), expected=True) info, './error', fatal=True), expected=True)
sources = xpath_element( sources = xpath_element(
info, './video_sources', 'sources', fatal=True) info, './video_sources', 'sources', fatal=True)
hash_values = xpath_element( hash_values = xpath_element(
info, './hash_values', 'hash values', fatal=False) info, './hash_values', 'hash values', fatal=True)
title = xpath_text(video, './title', fatal=True) title = xpath_text(video, './title', fatal=True)
@ -160,16 +136,15 @@ class VideaIE(InfoExtractor):
source_url = source.text source_url = source.text
source_name = source.get('name') source_name = source.get('name')
source_exp = source.get('exp') source_exp = source.get('exp')
if not (source_url and source_name): if not (source_url and source_name and source_exp):
continue continue
hash_value = ( hash_value = xpath_text(hash_values, 'hash_value_' + source_name)
xpath_text(hash_values, 'hash_value_' + source_name) if not hash_value:
if hash_values is not None else None) continue
if hash_value and source_exp: source_url = update_url_query(source_url, {
source_url = update_url_query(source_url, { 'md5': hash_value,
'md5': hash_value, 'expires': source_exp,
'expires': source_exp, })
})
f = parse_codecs(source.get('codecs')) f = parse_codecs(source.get('codecs'))
f.update({ f.update({
'url': self._proto_relative_url(source_url), 'url': self._proto_relative_url(source_url),