mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-26 10:24:33 +01:00
Fix download with Token Authentication from funk.net (Nexx Player)
This commit is contained in:
parent
049c0486bb
commit
f062558229
@ -247,20 +247,30 @@ class NexxIE(InfoExtractor):
|
||||
azure_manifest_url = '%s%s/%s_src%s.ism/Manifest' % (
|
||||
azure_stream_base, azure_locator, video_id, ('_manifest' if is_ml else '')) + '%s'
|
||||
|
||||
protection_token = try_get(
|
||||
video, lambda x: x['protectiondata']['token'], compat_str)
|
||||
if protection_token:
|
||||
azure_manifest_url += '?hdnts=%s' % protection_token
|
||||
# the simple token value is no longer used, instead use tokenDASH and/or tokenHLS
|
||||
protection_token_DASH = try_get(
|
||||
video, lambda x: x['protectiondata']['tokenDASH'], compat_str)
|
||||
if protection_token_DASH:
|
||||
azure_manifest_url_DASH = azure_manifest_url + '?hdnts=%s' % protection_token_DASH
|
||||
else:
|
||||
azure_manifest_url_DASH = azure_manifest_url
|
||||
|
||||
protection_token_HLS = try_get(
|
||||
video, lambda x: x['protectiondata']['tokenHLS'], compat_str)
|
||||
if protection_token_HLS:
|
||||
azure_manifest_url_HLS = azure_manifest_url + '?hdnts=%s' % protection_token_HLS
|
||||
else:
|
||||
azure_manifest_url_HLS = azure_manifest_url
|
||||
|
||||
formats = self._extract_m3u8_formats(
|
||||
azure_manifest_url % '(format=m3u8-aapl)',
|
||||
azure_manifest_url_HLS % '(format=m3u8-aapl)',
|
||||
video_id, 'mp4', 'm3u8_native',
|
||||
m3u8_id='%s-hls' % cdn, fatal=False)
|
||||
formats.extend(self._extract_mpd_formats(
|
||||
azure_manifest_url % '(format=mpd-time-csf)',
|
||||
azure_manifest_url_DASH % '(format=mpd-time-csf)',
|
||||
video_id, mpd_id='%s-dash' % cdn, fatal=False))
|
||||
formats.extend(self._extract_ism_formats(
|
||||
azure_manifest_url % '', video_id, ism_id='%s-mss' % cdn, fatal=False))
|
||||
azure_manifest_url_DASH % '', video_id, ism_id='%s-mss' % cdn, fatal=False))
|
||||
|
||||
azure_progressive_base = get_cdn_shield_base('Prog', True)
|
||||
azure_file_distribution = stream_data.get('azureFileDistribution')
|
||||
@ -313,8 +323,16 @@ class NexxIE(InfoExtractor):
|
||||
if result:
|
||||
video = find_video(result)
|
||||
|
||||
if video:
|
||||
# search for protection tokens -- if they're present we have to go
|
||||
# through the procedure below...
|
||||
tokenDASH = try_get(
|
||||
video, lambda x: x['protectiondata']['tokenDASH'], compat_str)
|
||||
tokenHLS = try_get(
|
||||
video, lambda x: x['protectiondata']['tokenHLS'], compat_str)
|
||||
|
||||
# not all videos work via arc, e.g. nexx:741:1269984
|
||||
if not video:
|
||||
if not video or tokenDASH or tokenHLS:
|
||||
# Reverse engineered from JS code (see getDeviceID function)
|
||||
device_id = '%d:%d:%d%d' % (
|
||||
random.randint(1, 4), int(time.time()),
|
||||
|
Loading…
Reference in New Issue
Block a user