summaryrefslogtreecommitdiffstats
path: root/gallery_dl/downloader
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-03-10 03:44:57 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2025-03-10 03:44:57 -0400
commit243d1f1beb4e4eb75a524f1aff948c47761a4f1d (patch)
tree54f7ada7698d946f410500ad14f62798ca646956 /gallery_dl/downloader
parent889c7b8caec8fc0b9c7a583ed1d9cfa43518fc42 (diff)
New upstream version 1.29.1.upstream/1.29.1
Diffstat (limited to 'gallery_dl/downloader')
-rw-r--r--gallery_dl/downloader/common.py24
-rw-r--r--gallery_dl/downloader/http.py5
2 files changed, 22 insertions, 7 deletions
diff --git a/gallery_dl/downloader/common.py b/gallery_dl/downloader/common.py
index 8430884..dc1219f 100644
--- a/gallery_dl/downloader/common.py
+++ b/gallery_dl/downloader/common.py
@@ -19,6 +19,7 @@ class DownloaderBase():
def __init__(self, job):
extractor = job.extractor
+ self.log = job.get_logger("downloader." + self.scheme)
opts = self._extractor_config(extractor)
if opts:
@@ -29,7 +30,6 @@ class DownloaderBase():
self.session = extractor.session
self.part = self.config("part", True)
self.partdir = self.config("part-directory")
- self.log = job.get_logger("downloader." + self.scheme)
if self.partdir:
self.partdir = util.expand_path(self.partdir)
@@ -73,17 +73,27 @@ class DownloaderBase():
copts = cfg.get(self.scheme)
if copts:
if subcategory in cfg:
- sopts = cfg[subcategory].get(self.scheme)
- if sopts:
- opts = copts.copy()
- opts.update(sopts)
- return opts
+ try:
+ sopts = cfg[subcategory].get(self.scheme)
+ if sopts:
+ opts = copts.copy()
+ opts.update(sopts)
+ return opts
+ except Exception:
+ self._report_config_error(subcategory, cfg[subcategory])
return copts
if subcategory in cfg:
- return cfg[subcategory].get(self.scheme)
+ try:
+ return cfg[subcategory].get(self.scheme)
+ except Exception:
+ self._report_config_error(subcategory, cfg[subcategory])
return None
+ def _report_config_error(self, subcategory, value):
+ config.log.warning("Subcategory '%s' set to '%s' instead of object",
+ subcategory, util.json_dumps(value).strip('"'))
+
def download(self, url, pathfmt):
"""Write data from 'url' into the file specified by 'pathfmt'"""
diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py
index 449ffe8..faea9e5 100644
--- a/gallery_dl/downloader/http.py
+++ b/gallery_dl/downloader/http.py
@@ -184,6 +184,11 @@ class HttpDownloader(DownloaderBase):
break
else:
msg = "'{} {}' for '{}'".format(code, response.reason, url)
+
+ challenge = util.detect_challenge(response)
+ if challenge is not None:
+ self.log.warning(challenge)
+
if code in self.retry_codes or 500 <= code < 600:
continue
retry = kwdict.get("_http_retry")