diff options
| author | 2023-01-12 03:41:59 -0500 | |
|---|---|---|
| committer | 2023-01-12 03:41:59 -0500 | |
| commit | f1051085013c0d702ef974b9b27ea43b3fc73259 (patch) | |
| tree | aaeb581d7b2ba0652b5e74b714b9036dd4436d4d /gallery_dl | |
| parent | fe385c3ff784ba3d19454a35446502c0ec295893 (diff) | |
New upstream version 1.24.4.upstream/1.24.4
Diffstat (limited to 'gallery_dl')
| -rw-r--r-- | gallery_dl/downloader/http.py | 5 | ||||
| -rw-r--r-- | gallery_dl/extractor/kemonoparty.py | 14 | ||||
| -rw-r--r-- | gallery_dl/version.py | 2 |
3 files changed, 13 insertions, 8 deletions
diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py index 4037420..0bf19c2 100644 --- a/gallery_dl/downloader/http.py +++ b/gallery_dl/downloader/http.py @@ -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 diff --git a/gallery_dl/extractor/kemonoparty.py b/gallery_dl/extractor/kemonoparty.py index 541e427..63e3084 100644 --- a/gallery_dl/extractor/kemonoparty.py +++ b/gallery_dl/extractor/kemonoparty.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2021-2022 Mike Fährmann +# Copyright 2021-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 @@ -67,7 +67,6 @@ class KemonopartyExtractor(Extractor): headers["Referer"] = "{}/{}/user/{}/post/{}".format( self.root, post["service"], post["user"], post["id"]) post["_http_headers"] = headers - post["_http_validate"] = _validate post["date"] = text.parse_datetime( post["published"] or post["added"], "%a, %d %b %Y %H:%M:%S %Z") @@ -103,13 +102,17 @@ class KemonopartyExtractor(Extractor): yield Message.Directory, post for post["num"], file in enumerate(files, 1): + post["_http_validate"] = None post["hash"] = file["hash"] post["type"] = file["type"] url = file["path"] text.nameext_from_url(file.get("name", url), post) + ext = text.ext_from_url(url) if not post["extension"]: - post["extension"] = text.ext_from_url(url) + post["extension"] = ext + elif ext == "txt" and post["extension"] != "txt": + post["_http_validate"] = _validate if url[0] == "/": url = self.root + "/data" + url @@ -199,7 +202,7 @@ class KemonopartyExtractor(Extractor): def _validate(response): - return (response.headers["content-length"] != "9" and + return (response.headers["content-length"] != "9" or response.content != b"not found") @@ -250,6 +253,7 @@ class KemonopartyPostExtractor(KemonopartyExtractor): ("https://kemono.party/fanbox/user/6993449/post/506575", { "pattern": r"https://kemono.party/data/21/0f" r"/210f35388e28bbcf756db18dd516e2d82ce75[0-9a-f]+\.jpg", + "content": "900949cefc97ab8dc1979cc3664785aac5ba70dd", "keyword": { "added": "Wed, 06 May 2020 20:28:02 GMT", "content": str, @@ -319,7 +323,7 @@ class KemonopartyPostExtractor(KemonopartyExtractor): ("https://kemono.party/patreon/user/19623797/post/29035449", { "pattern": r"907ba78b4545338d3539683e63ecb51c" r"f51c10adc9dabd86e92bd52339f298b9\.txt", - "content": "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "content": "da39a3ee5e6b4b0d3255bfef95601890afd80709", # empty }), ("https://kemono.party/subscribestar/user/alcorart/post/184330"), ("https://www.kemono.party/subscribestar/user/alcorart/post/184330"), diff --git a/gallery_dl/version.py b/gallery_dl/version.py index 5e3b507..aec56c9 100644 --- a/gallery_dl/version.py +++ b/gallery_dl/version.py @@ -6,4 +6,4 @@ # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -__version__ = "1.24.3" +__version__ = "1.24.4" |
