[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,
parse_codecs,
update_url_query,
urljoin,
xpath_element,
xpath_text,
)
@ -19,6 +20,7 @@
compat_b64decode,
compat_ord,
compat_struct_pack,
compat_urlparse,
)
@ -95,9 +97,13 @@ def rc4(cipher_text, key):
def _real_extract(self, url):
video_id = self._match_id(url)
query = {'v': video_id}
player_page = self._download_webpage(
'https://videa.hu/player', video_id, query=query)
video_page = self._download_webpage(url, video_id)
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(
r'_xt\s*=\s*"([^"]+)"', player_page, 'nonce')
@ -107,6 +113,7 @@ def _real_extract(self, url):
for i in range(0, 32):
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))
query['_s'] = random_seed
query['_t'] = result[:16]