This commit is contained in:
yeeeha 2020-09-25 19:46:03 +08:00 committed by GitHub
commit 68cd181341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 8 deletions

View File

@ -247,20 +247,25 @@ 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)
protection_token_HLS = try_get(
video, lambda x: x['protectiondata']['tokenHLS'], compat_str)
azure_manifest_url_DASH = azure_manifest_url + '?hdnts=%s' % protection_token_DASH
azure_manifest_url_HLS = azure_manifest_url + '?hdnts=%s' % protection_token_HLS
formats = self._extract_m3u8_formats(
azure_manifest_url % '(format=m3u8-aapl)',
(azure_manifest_url_HLS if protection_token_HLS else azure_manifest_url) % '(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 if protection_token_DASH else azure_manifest_url) % '(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 if protection_token_DASH else azure_manifest_url) % '',
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 +318,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()),