This commit is contained in:
David Sn 2020-10-22 17:55:23 +02:00 committed by GitHub
commit dbf1d2504f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import codecs
import re
from .common import InfoExtractor
from ..compat import compat_urllib_parse_unquote
from ..utils import (
ExtractorError,
float_or_none,
@ -123,6 +124,28 @@ class CDAIE(InfoExtractor):
'age_limit': 18 if need_confirm_age else 0,
}
def decrypt_file(a):
# first replace very cringy joke, then apply decodeURIComponent
a = compat_urllib_parse_unquote(a.replace("_XDDD", ""))
# store decrypted characters
b = []
for e in range(len(a)):
f = ord(a[e])
b.append(chr(33 + (f + 14) % 94) if 33 <= f and 126 >= f else chr(f))
# decrypted URL
a = "".join(b)
# more "obfuscation" to deal with
a = a.replace(".cda.mp4", "")
a = a.replace(".2cda.pl", ".cda.pl")
a = a.replace(".3cda.pl", ".cda.pl")
# return extracted file as URL to video file
return "https://" + a + ".mp4"
def extract_format(page, version):
json_str = self._html_search_regex(
r'player_data=(\\?["\'])(?P<player_data>.+?)\1', page,
@ -137,7 +160,9 @@ class CDAIE(InfoExtractor):
if not video or 'file' not in video:
self.report_warning('Unable to extract %s version information' % version)
return
if video['file'].startswith('uggc'):
if "http" not in video['file'] and ".mp4" not in video['file'] and "uggcf://" not in video['file']:
video['file'] = decrypt_file(video['file'])
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')