From 388bc4a640561b78a8d38e95253721e7715b22cc Mon Sep 17 00:00:00 2001 From: Ashish Gupta <39122144+Ashish0804@users.noreply.github.com> Date: Thu, 23 Sep 2021 14:30:49 +0530 Subject: [PATCH] [Hotstar] Add referer for subs (#1062) Authored by: Ashish0804 --- yt_dlp/YoutubeDL.py | 4 +++- yt_dlp/extractor/hotstar.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index d05d85604..410186b91 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -2594,7 +2594,9 @@ def process_info(self, info_dict): 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 8d8a8bd75..8f0c67303 100644 --- a/yt_dlp/extractor/hotstar.py +++ b/yt_dlp/extractor/hotstar.py @@ -254,6 +254,9 @@ def _real_extract(self, url): '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', + } }