diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-02-11 23:30:48 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-02-11 23:31:12 +0530 |
commit | 297e9952b65cfd03aab2d0b97c8cf18243d12578 (patch) | |
tree | c3f189dfb8b40e756994a92c0b5852caeaadd7bb | |
parent | dca4f462742d64ab82e943c7560d0d9cbc5a9305 (diff) | |
download | hypervideo-pre-297e9952b65cfd03aab2d0b97c8cf18243d12578.tar.lz hypervideo-pre-297e9952b65cfd03aab2d0b97c8cf18243d12578.tar.xz hypervideo-pre-297e9952b65cfd03aab2d0b97c8cf18243d12578.zip |
[extractor] Allow `http_headers` to be specified for `thumbnails`
-rw-r--r-- | yt_dlp/YoutubeDL.py | 2 | ||||
-rw-r--r-- | yt_dlp/extractor/common.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index fd1584a7f..74684dea3 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -3860,7 +3860,7 @@ class YoutubeDL(object): else: self.to_screen(f'[info] Downloading {thumb_display_id} ...') try: - uf = self.urlopen(t['url']) + uf = self.urlopen(sanitized_Request(t['url'], headers=t.get('http_headers', {}))) self.to_screen(f'[info] Writing {thumb_display_id} to: {thumb_filename}') with open(encodeFilename(thumb_filename), 'wb') as thumbf: shutil.copyfileobj(uf, thumbf) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 3b232e89c..37c8be5f6 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -239,6 +239,7 @@ class InfoExtractor(object): * "resolution" (optional, string "{width}x{height}", deprecated) * "filesize" (optional, int) + * "http_headers" (dict) - HTTP headers for the request thumbnail: Full URL to a video thumbnail image. description: Full video description. uploader: Full name of the video uploader. @@ -272,6 +273,8 @@ class InfoExtractor(object): * "url": A URL pointing to the subtitles file It can optionally also have: * "name": Name or description of the subtitles + * http_headers: A dictionary of additional HTTP headers + to add to the request. "ext" will be calculated from URL if missing automatic_captions: Like 'subtitles'; contains automatically generated captions instead of normal subtitles |