[nexx] make http format ids more consistent

This commit is contained in:
Remita Amine 2017-11-25 18:36:31 +01:00
parent a238a868ba
commit b485d5d6bf

View File

@ -198,18 +198,15 @@ def _real_extract(self, url):
AZURE_URL = 'http://nx%s%02d.akamaized.net/' AZURE_URL = 'http://nx%s%02d.akamaized.net/'
def get_cdn_base(cdn, prefix='-p'): def get_cdn_shield_base(shield_type='', prefix='-p'):
azure_base = None
for secure in ('', 's'): for secure in ('', 's'):
cdn_shield = stream_data.get('cdn%sHTTP%s' % (cdn, secure.upper())) cdn_shield = stream_data.get('cdnShield%sHTTP%s' % (shield_type, secure.upper()))
if cdn_shield: if cdn_shield:
azure_base = 'http%s://%s' % (secure, cdn_shield) return 'http%s://%s' % (secure, cdn_shield)
break
else: else:
azure_base = AZURE_URL % (prefix, int(stream_data['azureAccount'].replace('nexxplayplus', ''))) return AZURE_URL % (prefix, int(stream_data['azureAccount'].replace('nexxplayplus', '')))
return azure_base
azure_stream_base = get_cdn_base('Shield') azure_stream_base = get_cdn_shield_base()
is_ml = ',' in language is_ml = ',' in language
azure_manifest_url = '%s%s/%s_src%s.ism/Manifest' % ( azure_manifest_url = '%s%s/%s_src%s.ism/Manifest' % (
azure_stream_base, azure_locator, video_id, ('_manifest' if is_ml else '')) + '%s' azure_stream_base, azure_locator, video_id, ('_manifest' if is_ml else '')) + '%s'
@ -229,7 +226,7 @@ def get_cdn_base(cdn, prefix='-p'):
formats.extend(self._extract_ism_formats( formats.extend(self._extract_ism_formats(
azure_manifest_url % '', video_id, ism_id='%s-mss' % cdn, fatal=False)) azure_manifest_url % '', video_id, ism_id='%s-mss' % cdn, fatal=False))
azure_progressive_base = get_cdn_base('ShieldProg', '-d') azure_progressive_base = get_cdn_shield_base('Prog', '-d')
azure_file_distribution = stream_data.get('azureFileDistribution') azure_file_distribution = stream_data.get('azureFileDistribution')
if azure_file_distribution: if azure_file_distribution:
fds = azure_file_distribution.split(',') fds = azure_file_distribution.split(',')
@ -242,7 +239,7 @@ def get_cdn_base(cdn, prefix='-p'):
f = { f = {
'url': '%s%s/%s_src_%s_%d.mp4' % ( 'url': '%s%s/%s_src_%s_%d.mp4' % (
azure_progressive_base, azure_locator, video_id, ss[1], tbr), azure_progressive_base, azure_locator, video_id, ss[1], tbr),
'format_id': 'http-%d' % tbr, 'format_id': '%s-http-%d' % (cdn, tbr),
'tbr': tbr, 'tbr': tbr,
} }
width_height = ss[1].split('x') width_height = ss[1].split('x')