[Hotstar] Mention Dynamic Range in format id (#1265)

Authored by: Ashish0804
This commit is contained in:
Ashish Gupta 2021-10-14 14:44:14 +05:30 committed by GitHub
parent 6993f78d1b
commit a64907d0ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,7 +70,7 @@ def _call_api(self, path, video_id, query_name='contentId'):
def _call_api_v2(self, path, video_id, st=None, cookies=None): def _call_api_v2(self, path, video_id, st=None, cookies=None):
return self._call_api_impl( return self._call_api_impl(
'%s/content/%s' % (path, video_id), video_id, st=st, cookies=cookies, query={ '%s/content/%s' % (path, video_id), video_id, st=st, cookies=cookies, query={
'desired-config': 'audio_channel:stereo|dynamic_range:sdr|encryption:plain|ladder:tv|package:dash|resolution:hd|subs-tag:HotstarVIP|video_codec:vp9', 'desired-config': 'audio_channel:stereo|container:fmp4|dynamic_range:hdr|encryption:plain|ladder:tv|package:dash|resolution:fhd|subs-tag:HotstarVIP|video_codec:h265',
'device-id': cookies.get('device_id').value if cookies.get('device_id') else compat_str(uuid.uuid4()), 'device-id': cookies.get('device_id').value if cookies.get('device_id') else compat_str(uuid.uuid4()),
'os-name': 'Windows', 'os-name': 'Windows',
'os-version': '10', 'os-version': '10',
@ -196,6 +196,7 @@ def _real_extract(self, url):
for playback_set in playback_sets: for playback_set in playback_sets:
if not isinstance(playback_set, dict): if not isinstance(playback_set, dict):
continue continue
dr = re.search(r'dynamic_range:(?P<dr>[a-z]+)', playback_set.get('tagsCombination')).group('dr')
format_url = url_or_none(playback_set.get('playbackUrl')) format_url = url_or_none(playback_set.get('playbackUrl'))
if not format_url: if not format_url:
continue continue
@ -210,12 +211,12 @@ def _real_extract(self, url):
hls_formats, hls_subs = self._extract_m3u8_formats_and_subtitles( hls_formats, hls_subs = self._extract_m3u8_formats_and_subtitles(
format_url, video_id, 'mp4', format_url, video_id, 'mp4',
entry_protocol='m3u8_native', entry_protocol='m3u8_native',
m3u8_id='hls', headers=headers) m3u8_id=f'{dr}-hls', headers=headers)
formats.extend(hls_formats) formats.extend(hls_formats)
subs = self._merge_subtitles(subs, hls_subs) subs = self._merge_subtitles(subs, hls_subs)
elif 'package:dash' in tags or ext == 'mpd': elif 'package:dash' in tags or ext == 'mpd':
dash_formats, dash_subs = self._extract_mpd_formats_and_subtitles( dash_formats, dash_subs = self._extract_mpd_formats_and_subtitles(
format_url, video_id, mpd_id='dash', headers=headers) format_url, video_id, mpd_id=f'{dr}-dash', headers=headers)
formats.extend(dash_formats) formats.extend(dash_formats)
subs = self._merge_subtitles(subs, dash_subs) subs = self._merge_subtitles(subs, dash_subs)
elif ext == 'f4m': elif ext == 'f4m':