mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
[downloader:http] add 'headers' option (#1322)
This commit is contained in:
parent
6b0ecbf6bc
commit
560277394e
@ -1843,6 +1843,16 @@ Description
|
||||
and adjust their filename extensions if they do not match.
|
||||
|
||||
|
||||
downloader.http.headers
|
||||
-----------------------
|
||||
Type
|
||||
``object``
|
||||
Example
|
||||
``{"Accept": "image/webp,*/*", "Referer": "https://example.org/"}``
|
||||
Description
|
||||
Additional HTTP headers to send when downloading files,
|
||||
|
||||
|
||||
downloader.ytdl.format
|
||||
----------------------
|
||||
Type
|
||||
|
@ -31,6 +31,7 @@ class HttpDownloader(DownloaderBase):
|
||||
self.downloading = False
|
||||
|
||||
self.adjust_extension = self.config("adjust-extensions", True)
|
||||
self.headers = self.config("headers")
|
||||
self.minsize = self.config("filesize-min")
|
||||
self.maxsize = self.config("filesize-max")
|
||||
self.retries = self.config("retries", extractor._retries)
|
||||
@ -100,6 +101,9 @@ class HttpDownloader(DownloaderBase):
|
||||
file_size = pathfmt.part_size()
|
||||
if file_size:
|
||||
headers["Range"] = "bytes={}-".format(file_size)
|
||||
# general headers
|
||||
if self.headers:
|
||||
headers.update(self.headers)
|
||||
# file-specific headers
|
||||
extra = pathfmt.kwdict.get("_http_headers")
|
||||
if extra:
|
||||
|
Loading…
Reference in New Issue
Block a user