mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
[downloader:http] add 'validate' option
This commit is contained in:
parent
85bd1cbc89
commit
c0d7d2be35
@ -3466,6 +3466,19 @@ Description
|
||||
regardless of this option.
|
||||
|
||||
|
||||
downloader.http.validate
|
||||
------------------------
|
||||
Type
|
||||
``bool``
|
||||
Default
|
||||
``true``
|
||||
Description
|
||||
Check for invalid responses.
|
||||
|
||||
Fail a download when a file does not pass
|
||||
instead of downloading a potentially broken file.
|
||||
|
||||
|
||||
downloader.ytdl.format
|
||||
----------------------
|
||||
Type
|
||||
|
@ -390,7 +390,8 @@
|
||||
{
|
||||
"adjust-extensions": true,
|
||||
"chunk-size": 32768,
|
||||
"headers": null
|
||||
"headers": null,
|
||||
"validate": true
|
||||
},
|
||||
|
||||
"ytdl":
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2014-2022 Mike Fährmann
|
||||
# Copyright 2014-2023 Mike Fährmann
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
@ -33,6 +33,7 @@ class HttpDownloader(DownloaderBase):
|
||||
self.chunk_size = self.config("chunk-size", 32768)
|
||||
self.metadata = extractor.config("http-metadata")
|
||||
self.progress = self.config("progress", 3.0)
|
||||
self.validate = self.config("validate", True)
|
||||
self.headers = self.config("headers")
|
||||
self.minsize = self.config("filesize-min")
|
||||
self.maxsize = self.config("filesize-max")
|
||||
@ -175,7 +176,7 @@ class HttpDownloader(DownloaderBase):
|
||||
|
||||
# check for invalid responses
|
||||
validate = kwdict.get("_http_validate")
|
||||
if validate:
|
||||
if validate and self.validate:
|
||||
result = validate(response)
|
||||
if isinstance(result, str):
|
||||
url = result
|
||||
|
Loading…
Reference in New Issue
Block a user