Add fallback known-plaintext
There seems to be some "special" URLs that are not served from their CDN.
This commit is contained in:
parent
7ab078eae9
commit
6dd969ade4
@ -100,17 +100,21 @@ class MixcloudIE(InfoExtractor):
|
|||||||
js = self._download_webpage(js_url, track_id)
|
js = self._download_webpage(js_url, track_id)
|
||||||
# Known plaintext attack
|
# Known plaintext attack
|
||||||
if encrypted_play_info:
|
if encrypted_play_info:
|
||||||
kp = '{"stream_url":'
|
kps = ['{"stream_url":']
|
||||||
kpa_target = encrypted_play_info
|
kpa_target = encrypted_play_info
|
||||||
else:
|
else:
|
||||||
kp = 'https://'
|
kps = ['https://', 'http://']
|
||||||
kpa_target = base64.b64decode(info_json['streamInfo']['url'])
|
kpa_target = base64.b64decode(info_json['streamInfo']['url'])
|
||||||
|
for kp in kps:
|
||||||
partial_key = self._decrypt_xor_cipher(kpa_target, kp)
|
partial_key = self._decrypt_xor_cipher(kpa_target, kp)
|
||||||
for quote in ["'", '"']:
|
for quote in ["'", '"']:
|
||||||
key = self._search_regex(r'{0}({1}[^{0}]*){0}'.format(quote, re.escape(partial_key)), js,
|
key = self._search_regex(r'{0}({1}[^{0}]*){0}'.format(quote, re.escape(partial_key)), js,
|
||||||
"encryption key", default=None)
|
"encryption key", default=None)
|
||||||
if key is not None:
|
if key is not None:
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
|
||||||
if encrypted_play_info is not None:
|
if encrypted_play_info is not None:
|
||||||
play_info = self._parse_json(self._decrypt_xor_cipher(key, encrypted_play_info), 'play info')
|
play_info = self._parse_json(self._decrypt_xor_cipher(key, encrypted_play_info), 'play info')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user