mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-23 02:26:37 -05:00
[extractor] Allow http_headers
to be specified for thumbnails
This commit is contained in:
parent
dca4f46274
commit
297e9952b6
@ -3860,7 +3860,7 @@ class YoutubeDL(object):
|
|||||||
else:
|
else:
|
||||||
self.to_screen(f'[info] Downloading {thumb_display_id} ...')
|
self.to_screen(f'[info] Downloading {thumb_display_id} ...')
|
||||||
try:
|
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}')
|
self.to_screen(f'[info] Writing {thumb_display_id} to: {thumb_filename}')
|
||||||
with open(encodeFilename(thumb_filename), 'wb') as thumbf:
|
with open(encodeFilename(thumb_filename), 'wb') as thumbf:
|
||||||
shutil.copyfileobj(uf, thumbf)
|
shutil.copyfileobj(uf, thumbf)
|
||||||
|
@ -239,6 +239,7 @@ class InfoExtractor(object):
|
|||||||
* "resolution" (optional, string "{width}x{height}",
|
* "resolution" (optional, string "{width}x{height}",
|
||||||
deprecated)
|
deprecated)
|
||||||
* "filesize" (optional, int)
|
* "filesize" (optional, int)
|
||||||
|
* "http_headers" (dict) - HTTP headers for the request
|
||||||
thumbnail: Full URL to a video thumbnail image.
|
thumbnail: Full URL to a video thumbnail image.
|
||||||
description: Full video description.
|
description: Full video description.
|
||||||
uploader: Full name of the video uploader.
|
uploader: Full name of the video uploader.
|
||||||
@ -272,6 +273,8 @@ class InfoExtractor(object):
|
|||||||
* "url": A URL pointing to the subtitles file
|
* "url": A URL pointing to the subtitles file
|
||||||
It can optionally also have:
|
It can optionally also have:
|
||||||
* "name": Name or description of the subtitles
|
* "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
|
"ext" will be calculated from URL if missing
|
||||||
automatic_captions: Like 'subtitles'; contains automatically generated
|
automatic_captions: Like 'subtitles'; contains automatically generated
|
||||||
captions instead of normal subtitles
|
captions instead of normal subtitles
|
||||||
|
Loading…
Reference in New Issue
Block a user