From 5d5c0f7e99d121aa0db476b1166828af552aeb14 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 16 May 2022 19:37:05 +0530 Subject: [PATCH] [Hotstar] Bugfix for a1ddaa899ca8693f31f34770f7263ace7e8c8841 Closes #3595 --- yt_dlp/extractor/hotstar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/hotstar.py b/yt_dlp/extractor/hotstar.py index fe16de6655..d9223a4164 100644 --- a/yt_dlp/extractor/hotstar.py +++ b/yt_dlp/extractor/hotstar.py @@ -70,8 +70,7 @@ class HotStarBaseIE(InfoExtractor): 'x-platform-code': 'PCTV', }) - def _call_api_v2(self, path, video_id, st=None): - cookies = self._get_cookies(self._BASE_URL) + def _call_api_v2(self, path, video_id, st=None, cookies=None): return self._call_api_impl( f'{path}/content/{video_id}', video_id, st=st, cookies=cookies, query={ 'desired-config': 'audio_channel:stereo|container:fmp4|dynamic_range:hdr|encryption:plain|ladder:tv|package:dash|resolution:fhd|subs-tag:HotstarVIP|video_codec:h265', @@ -160,6 +159,7 @@ class HotStarIE(HotStarBaseIE): def _real_extract(self, url): video_id, video_type = self._match_valid_url(url).group('id', 'type') video_type = self._TYPE.get(video_type, video_type) + cookies = self._get_cookies(url) # Cookies before any request video_data = self._call_api(f'o/v1/{video_type}/detail', video_id)['body']['results']['item'] if not self.get_param('allow_unplayable_formats') and video_data.get('drmProtected'): @@ -173,7 +173,7 @@ class HotStarIE(HotStarBaseIE): headers = {'Referer': f'{self._BASE_URL}/in'} # change to v2 in the future - playback_sets = self._call_api_v2('play/v1/playback', video_id, st=st)['playBackSets'] + playback_sets = self._call_api_v2('play/v1/playback', video_id, st=st, cookies=cookies)['playBackSets'] for playback_set in playback_sets: if not isinstance(playback_set, dict): continue