mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 16:42:57 +01:00
parent
e107c2b8cf
commit
efa944f4bc
@ -1068,7 +1068,7 @@ def _outtmpl_expandpath(outtmpl):
|
|||||||
# correspondingly that is not what we want since we need to keep
|
# correspondingly that is not what we want since we need to keep
|
||||||
# '%%' intact for template dict substitution step. Working around
|
# '%%' intact for template dict substitution step. Working around
|
||||||
# with boundary-alike separator hack.
|
# with boundary-alike separator hack.
|
||||||
sep = ''.join([random.choice(ascii_letters) for _ in range(32)])
|
sep = ''.join(random.choices(ascii_letters, k=32))
|
||||||
outtmpl = outtmpl.replace('%%', f'%{sep}%').replace('$$', f'${sep}$')
|
outtmpl = outtmpl.replace('%%', f'%{sep}%').replace('$$', f'${sep}$')
|
||||||
|
|
||||||
# outtmpl should be expand_path'ed before template dict substitution
|
# outtmpl should be expand_path'ed before template dict substitution
|
||||||
|
@ -168,7 +168,7 @@ def _real_extract(self, url):
|
|||||||
}, data=b'')['token']
|
}, data=b'')['token']
|
||||||
|
|
||||||
links_url = try_get(options, lambda x: x['video']['url']) or (video_base_url + 'link')
|
links_url = try_get(options, lambda x: x['video']['url']) or (video_base_url + 'link')
|
||||||
self._K = ''.join([random.choice('0123456789abcdef') for _ in range(16)])
|
self._K = ''.join(random.choices('0123456789abcdef', k=16))
|
||||||
message = bytes_to_intlist(json.dumps({
|
message = bytes_to_intlist(json.dumps({
|
||||||
'k': self._K,
|
'k': self._K,
|
||||||
't': token,
|
't': token,
|
||||||
|
@ -78,7 +78,7 @@ def _real_extract(self, url):
|
|||||||
'Downloading token JSON metadata', query={
|
'Downloading token JSON metadata', query={
|
||||||
'authRel': 'authorization',
|
'authRel': 'authorization',
|
||||||
'client_id': '3020a40c2356a645b4b4',
|
'client_id': '3020a40c2356a645b4b4',
|
||||||
'nonce': ''.join([random.choice(string.ascii_letters) for _ in range(32)]),
|
'nonce': ''.join(random.choices(string.ascii_letters, k=32)),
|
||||||
'redirectUri': 'https://www.discovery.com/',
|
'redirectUri': 'https://www.discovery.com/',
|
||||||
})['access_token']
|
})['access_token']
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ def _real_extract(self, url):
|
|||||||
page = self._download_json(
|
page = self._download_json(
|
||||||
'https://www.funimation.com/api/showexperience/%s/' % experience_id,
|
'https://www.funimation.com/api/showexperience/%s/' % experience_id,
|
||||||
display_id, headers=headers, expected_status=403, query={
|
display_id, headers=headers, expected_status=403, query={
|
||||||
'pinst_id': ''.join([random.choice(string.digits + string.ascii_letters) for _ in range(8)]),
|
'pinst_id': ''.join(random.choices(string.digits + string.ascii_letters, k=8)),
|
||||||
}, note=f'Downloading {format_name} JSON')
|
}, note=f'Downloading {format_name} JSON')
|
||||||
sources = page.get('items') or []
|
sources = page.get('items') or []
|
||||||
if not sources:
|
if not sources:
|
||||||
|
@ -75,9 +75,8 @@ class LinuxAcademyIE(InfoExtractor):
|
|||||||
|
|
||||||
def _perform_login(self, username, password):
|
def _perform_login(self, username, password):
|
||||||
def random_string():
|
def random_string():
|
||||||
return ''.join([
|
return ''.join(random.choices(
|
||||||
random.choice('0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._~')
|
'0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._~', k=32))
|
||||||
for _ in range(32)])
|
|
||||||
|
|
||||||
webpage, urlh = self._download_webpage_handle(
|
webpage, urlh = self._download_webpage_handle(
|
||||||
self._AUTHORIZE_URL, None, 'Downloading authorize page', query={
|
self._AUTHORIZE_URL, None, 'Downloading authorize page', query={
|
||||||
|
@ -32,7 +32,7 @@ def _get_ckey(self, video_id, url, guid):
|
|||||||
padding_mode='whitespace').hex().upper()
|
padding_mode='whitespace').hex().upper()
|
||||||
|
|
||||||
def _get_video_api_response(self, video_url, video_id, series_id, subtitle_format, video_format, video_quality):
|
def _get_video_api_response(self, video_url, video_id, series_id, subtitle_format, video_format, video_quality):
|
||||||
guid = ''.join([random.choice(string.digits + string.ascii_lowercase) for _ in range(16)])
|
guid = ''.join(random.choices(string.digits + string.ascii_lowercase, k=16))
|
||||||
ckey = self._get_ckey(video_id, video_url, guid)
|
ckey = self._get_ckey(video_id, video_url, guid)
|
||||||
query = {
|
query = {
|
||||||
'vid': video_id,
|
'vid': video_id,
|
||||||
@ -55,7 +55,7 @@ def _get_video_api_response(self, video_url, video_id, series_id, subtitle_forma
|
|||||||
'platform': self._PLATFORM,
|
'platform': self._PLATFORM,
|
||||||
# For VQQ
|
# For VQQ
|
||||||
'guid': guid,
|
'guid': guid,
|
||||||
'flowid': ''.join(random.choice(string.digits + string.ascii_lowercase) for _ in range(32)),
|
'flowid': ''.join(random.choices(string.digits + string.ascii_lowercase, k=32)),
|
||||||
}
|
}
|
||||||
|
|
||||||
return self._search_json(r'QZOutputJson=', self._download_webpage(
|
return self._search_json(r'QZOutputJson=', self._download_webpage(
|
||||||
|
@ -49,7 +49,7 @@ def _get_sigi_state(self, webpage, display_id):
|
|||||||
|
|
||||||
def _call_api_impl(self, ep, query, manifest_app_version, video_id, fatal=True,
|
def _call_api_impl(self, ep, query, manifest_app_version, video_id, fatal=True,
|
||||||
note='Downloading API JSON', errnote='Unable to download API page'):
|
note='Downloading API JSON', errnote='Unable to download API page'):
|
||||||
self._set_cookie(self._API_HOSTNAME, 'odin_tt', ''.join(random.choice('0123456789abcdef') for _ in range(160)))
|
self._set_cookie(self._API_HOSTNAME, 'odin_tt', ''.join(random.choices('0123456789abcdef', k=160)))
|
||||||
webpage_cookies = self._get_cookies(self._WEBPAGE_HOST)
|
webpage_cookies = self._get_cookies(self._WEBPAGE_HOST)
|
||||||
if webpage_cookies.get('sid_tt'):
|
if webpage_cookies.get('sid_tt'):
|
||||||
self._set_cookie(self._API_HOSTNAME, 'sid_tt', webpage_cookies['sid_tt'].value)
|
self._set_cookie(self._API_HOSTNAME, 'sid_tt', webpage_cookies['sid_tt'].value)
|
||||||
@ -68,8 +68,8 @@ def _build_api_query(self, query, app_version, manifest_app_version):
|
|||||||
'build_number': app_version,
|
'build_number': app_version,
|
||||||
'manifest_version_code': manifest_app_version,
|
'manifest_version_code': manifest_app_version,
|
||||||
'update_version_code': manifest_app_version,
|
'update_version_code': manifest_app_version,
|
||||||
'openudid': ''.join(random.choice('0123456789abcdef') for _ in range(16)),
|
'openudid': ''.join(random.choices('0123456789abcdef', k=16)),
|
||||||
'uuid': ''.join([random.choice(string.digits) for _ in range(16)]),
|
'uuid': ''.join(random.choices(string.digits, k=16)),
|
||||||
'_rticket': int(time.time() * 1000),
|
'_rticket': int(time.time() * 1000),
|
||||||
'ts': int(time.time()),
|
'ts': int(time.time()),
|
||||||
'device_brand': 'Google',
|
'device_brand': 'Google',
|
||||||
@ -638,7 +638,7 @@ def _video_entries_api(self, webpage, user_id, username):
|
|||||||
'max_cursor': 0,
|
'max_cursor': 0,
|
||||||
'min_cursor': 0,
|
'min_cursor': 0,
|
||||||
'retry_type': 'no_retry',
|
'retry_type': 'no_retry',
|
||||||
'device_id': ''.join(random.choice(string.digits) for _ in range(19)), # Some endpoints don't like randomized device_id, so it isn't directly set in _call_api.
|
'device_id': ''.join(random.choices(string.digits, k=19)), # Some endpoints don't like randomized device_id, so it isn't directly set in _call_api.
|
||||||
}
|
}
|
||||||
|
|
||||||
for page in itertools.count(1):
|
for page in itertools.count(1):
|
||||||
@ -686,7 +686,7 @@ def _entries(self, list_id, display_id):
|
|||||||
'cursor': 0,
|
'cursor': 0,
|
||||||
'count': 20,
|
'count': 20,
|
||||||
'type': 5,
|
'type': 5,
|
||||||
'device_id': ''.join(random.choice(string.digits) for i in range(19))
|
'device_id': ''.join(random.choices(string.digits, k=19))
|
||||||
}
|
}
|
||||||
|
|
||||||
for page in itertools.count(1):
|
for page in itertools.count(1):
|
||||||
|
@ -119,7 +119,7 @@ def _real_extract(self, url):
|
|||||||
result += s[i - (self._STATIC_SECRET.index(l[i]) - 31)]
|
result += s[i - (self._STATIC_SECRET.index(l[i]) - 31)]
|
||||||
|
|
||||||
query = parse_qs(player_url)
|
query = parse_qs(player_url)
|
||||||
random_seed = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(8))
|
random_seed = ''.join(random.choices(string.ascii_letters + string.digits, k=8))
|
||||||
query['_s'] = random_seed
|
query['_s'] = random_seed
|
||||||
query['_t'] = result[:16]
|
query['_t'] = result[:16]
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ def _login(self, country_code, video_id):
|
|||||||
return self._user_token
|
return self._user_token
|
||||||
|
|
||||||
def _get_token(self, country_code, video_id):
|
def _get_token(self, country_code, video_id):
|
||||||
rand = ''.join(random.choice('0123456789') for _ in range(10))
|
rand = ''.join(random.choices('0123456789', k=10))
|
||||||
return self._download_json(
|
return self._download_json(
|
||||||
f'https://api-gateway-global.viu.com/api/auth/token?v={rand}000', video_id,
|
f'https://api-gateway-global.viu.com/api/auth/token?v={rand}000', video_id,
|
||||||
headers={'Content-Type': 'application/json'}, note='Getting bearer token',
|
headers={'Content-Type': 'application/json'}, note='Getting bearer token',
|
||||||
|
@ -30,7 +30,7 @@ def _call_api(self, path, video_id, note, data=None):
|
|||||||
base_url = self._API_DOMAIN + '/core/' + path
|
base_url = self._API_DOMAIN + '/core/' + path
|
||||||
query = [
|
query = [
|
||||||
('oauth_consumer_key', self._API_PARAMS['oAuthKey']),
|
('oauth_consumer_key', self._API_PARAMS['oAuthKey']),
|
||||||
('oauth_nonce', ''.join([random.choice(string.ascii_letters) for _ in range(32)])),
|
('oauth_nonce', ''.join(random.choices(string.ascii_letters, k=32))),
|
||||||
('oauth_signature_method', 'HMAC-SHA1'),
|
('oauth_signature_method', 'HMAC-SHA1'),
|
||||||
('oauth_timestamp', int(time.time())),
|
('oauth_timestamp', int(time.time())),
|
||||||
]
|
]
|
||||||
|
@ -129,8 +129,8 @@ class YoukuIE(InfoExtractor):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_ysuid():
|
def get_ysuid():
|
||||||
return '%d%s' % (int(time.time()), ''.join([
|
return '%d%s' % (int(time.time()), ''.join(
|
||||||
random.choice(string.ascii_letters) for i in range(3)]))
|
random.choices(string.ascii_letters, k=3)))
|
||||||
|
|
||||||
def get_format_name(self, fm):
|
def get_format_name(self, fm):
|
||||||
_dict = {
|
_dict = {
|
||||||
|
Loading…
Reference in New Issue
Block a user