[videa] Fix extraction (#463)

Authored by: nyuszika7h
This commit is contained in:
nyuszika7h 2021-07-03 18:08:08 +02:00 committed by GitHub
parent 169dbde946
commit e010672ab5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,6 +12,7 @@
mimetype2ext, mimetype2ext,
parse_codecs, parse_codecs,
update_url_query, update_url_query,
urljoin,
xpath_element, xpath_element,
xpath_text, xpath_text,
) )
@ -19,6 +20,7 @@
compat_b64decode, compat_b64decode,
compat_ord, compat_ord,
compat_struct_pack, compat_struct_pack,
compat_urlparse,
) )
@ -95,9 +97,13 @@ def rc4(cipher_text, key):
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
query = {'v': video_id}
player_page = self._download_webpage( video_page = self._download_webpage(url, video_id)
'https://videa.hu/player', video_id, query=query)
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')
@ -107,6 +113,7 @@ def _real_extract(self, url):
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]