From 0a6b1044899f452cd10b6c7a6b00fa985a9a8b97 Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Fri, 27 Jun 2025 17:29:37 -0500 Subject: [PATCH] [ie/hotstar] Fix metadata extraction (#13560) Closes #7946 Authored by: bashonly --- yt_dlp/extractor/hotstar.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/yt_dlp/extractor/hotstar.py b/yt_dlp/extractor/hotstar.py index e97740c90..341786929 100644 --- a/yt_dlp/extractor/hotstar.py +++ b/yt_dlp/extractor/hotstar.py @@ -232,10 +232,15 @@ class HotStarIE(HotStarBaseIE): video_type = self._TYPE.get(video_type, video_type) cookies = self._get_cookies(url) # Cookies before any request - video_data = traverse_obj( - self._call_api_v1( - f'{video_type}/detail', video_id, fatal=False, query={'tas': 10000, 'contentId': video_id}), - ('body', 'results', 'item', {dict})) or {} + # tas=10000 can cause HTTP Error 504, see https://github.com/yt-dlp/yt-dlp/issues/7946 + for tas in (10000, 0): + query = {'tas': tas, 'contentId': video_id} + video_data = traverse_obj( + self._call_api_v1(f'{video_type}/detail', video_id, fatal=False, query=query), + ('body', 'results', 'item', {dict})) or {} + if video_data: + break + if not self.get_param('allow_unplayable_formats') and video_data.get('drmProtected'): self.report_drm(video_id)