1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 10:24:33 +01:00

[cda] Improve extraction and keep old method for legacy

It is unknown whether CDA keeps using the old ROT13 decode method,
as the original player.js code still contains the old method.

Signed-off-by: David Sn <divad.nnamtdeis@gmail.com>
This commit is contained in:
David Sn 2020-03-29 12:25:53 +02:00
parent 3574d22de9
commit fd76f28c6c
No known key found for this signature in database
GPG Key ID: 12608A286656086D

View File

@ -133,10 +133,6 @@ class CDAIE(InfoExtractor):
return "".join(b) return "".join(b)
def decode(file):
decoded = codecs.decode(codecs.decode(file, "rot_13"), "rot_13")
return "https://" + decrypt_file(compat_urllib_parse_unquote(decoded)) + ".mp4"
def extract_format(page, version): def extract_format(page, version):
json_str = self._html_search_regex( json_str = self._html_search_regex(
r'player_data=(\\?["\'])(?P<player_data>.+?)\1', page, r'player_data=(\\?["\'])(?P<player_data>.+?)\1', page,
@ -151,9 +147,14 @@ class CDAIE(InfoExtractor):
if not video or 'file' not in video: if not video or 'file' not in video:
self.report_warning('Unable to extract %s version information' % version) self.report_warning('Unable to extract %s version information' % version)
return return
video['file'] = decode(video['file']) if "http" not in video['file'] and ".mp4" not in video['file'] and "uggcf://" not in video['file']:
if video['file'].endswith('adc.mp4'): video['file'] = decrypt_file(compat_urllib_parse_unquote(video['file']))
video['file'] = video['file'].replace('adc.mp4', '.mp4') if not video['file'].startswith("http"):
video['file'] = "https://" + video['file'] + ".mp4"
elif video['file'].startswith('uggc'):
video['file'] = codecs.decode(video['file'], 'rot_13')
if video['file'].endswith('adc.mp4'):
video['file'] = video['file'].replace('adc.mp4', '.mp4')
f = { f = {
'url': video['file'], 'url': video['file'],
} }