]> jfr.im git - yt-dlp.git/commitdiff
Use headers and cookies when downloading subtitles (#173)
authorDamiano Amatruda <redacted>
Mon, 15 Mar 2021 17:13:16 +0000 (18:13 +0100)
committerpukkandan <redacted>
Sat, 20 Mar 2021 04:04:52 +0000 (09:34 +0530)
yt_dlp/YoutubeDL.py

index 482f1fbac83817747fb539c723d8b7d17add8f5f..6c2b9eb57ede1b97b45a54b71561ea6f712374f4 100644 (file)
@@ -2141,7 +2141,10 @@ def dl(name, info, subtitle=False):
                 fd.add_progress_hook(ph)
             if self.params.get('verbose'):
                 self.to_screen('[debug] Invoking downloader on %r' % info.get('url'))
-            return fd.download(name, info, subtitle)
+            new_info = dict(info)
+            if new_info.get('http_headers') is None:
+                new_info['http_headers'] = self._calc_headers(new_info)
+            return fd.download(name, new_info, subtitle)
 
         subtitles_are_requested = any([self.params.get('writesubtitles', False),
                                        self.params.get('writeautomaticsub')])