Skip to content

A feature-rich command-line audio/video downloader

[Hotstar] Add referer for subs (#1062)

Ashish Gupta388bc4a64056
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index d05d856042..410186b913 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -2594,7 +2594,9 @@ class YoutubeDL(object):
return
else:
try:
- self.dl(sub_filename, sub_info.copy(), subtitle=True)
+ sub_copy = sub_info.copy()
+ sub_copy.setdefault('http_headers', info_dict.get('http_headers'))
+ self.dl(sub_filename, sub_copy, subtitle=True)
sub_info['filepath'] = sub_filename
files_to_move[sub_filename] = sub_filename_final
except (ExtractorError, IOError, OSError, ValueError) + network_exceptions as err:
diff --git a/yt_dlp/extractor/hotstar.py b/yt_dlp/extractor/hotstar.py
index 8d8a8bd75e..8f0c673034 100644
--- a/yt_dlp/extractor/hotstar.py
+++ b/yt_dlp/extractor/hotstar.py
@@ -254,6 +254,9 @@ class HotStarIE(HotStarBaseIE):
'season_id': video_data.get('seasonId'),
'episode': title,
'episode_number': int_or_none(video_data.get('episodeNo')),
+ 'http_headers': {
+ 'Referer': 'https://www.hotstar.com/in',
+ }
}