From 4b268854a7519b6e5fa20dd1dd558a10090363ba Mon Sep 17 00:00:00 2001 From: bashonly Date: Sun, 13 Jul 2025 17:15:43 -0500 Subject: [PATCH] use `filter_dict` Authored by: bashonly --- yt_dlp/extractor/hotstar.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/hotstar.py b/yt_dlp/extractor/hotstar.py index 9fa834145..540bbcb73 100644 --- a/yt_dlp/extractor/hotstar.py +++ b/yt_dlp/extractor/hotstar.py @@ -12,6 +12,7 @@ ExtractorError, OnDemandPagedList, determine_ext, + filter_dict, int_or_none, join_nonempty, jwt_decode_hs256, @@ -58,13 +59,13 @@ def _call_api_impl(self, path, video_id, query, cookies=None, st=None): auth += '~hmac=' + hmac.new(self._AKAMAI_ENCRYPTION_KEY, auth.encode(), hashlib.sha256).hexdigest() response = self._download_json( f'{self._API_URL_V2}/{path}', video_id, query=query, - headers={ + headers=filter_dict({ **(self._SUB_HEADERS if self._has_active_subscription(cookies) else self._FREE_HEADERS), 'hotstarauth': auth, 'x-hs-usertoken': traverse_obj(cookies, (self._TOKEN_NAME, 'value')), 'x-hs-device-id': traverse_obj(cookies, ('deviceId', 'value')) or str(uuid.uuid4()), 'content-type': 'application/json', - }) + })) if not traverse_obj(response, ('success', {dict})): raise ExtractorError('API call was unsuccessful')