From 11ccadfd8c42bfbbdb1dc2c0ffe540ed18fff59c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 18 Oct 2025 20:57:58 +0200 Subject: [PATCH] [schalenetwork][hdoujin] re-implement 'cbz' option (#8431) --- docs/configuration.rst | 36 +++++++++++++++++++++++++-- docs/gallery-dl.conf | 2 ++ gallery_dl/extractor/schalenetwork.py | 14 +++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 8496dc1d..29fccf78 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -3284,6 +3284,19 @@ Description Recursively download files from subfolders. +extractor.hdoujin.cbz +--------------------- +Type + ``bool`` +Default + ``false`` +Description + Download each gallery as a single ``.cbz`` file. +Note + Requires a + `token `__ + + extractor.hdoujin.crt --------------------- Type @@ -3345,7 +3358,10 @@ Example Description ``Authorization`` header value used for requests to ``https://api.hdoujin.org`` - to access ``favorite`` galleries. + to access ``favorite`` galleries + or download + `.cbz `__ + archives. extractor.hentaifoundry.descriptions @@ -5163,6 +5179,19 @@ Description Download videos. +extractor.schalenetwork.cbz +--------------------------- +Type + ``bool`` +Default + ``false`` +Description + Download each gallery as a single ``.cbz`` file. +Note + Requires a + `token `__ + + extractor.schalenetwork.crt --------------------------- Type @@ -5227,7 +5256,10 @@ Example Description ``Authorization`` header value used for requests to ``https://api.schale.network`` - to access ``favorite`` galleries. + to access ``favorite`` galleries + or download + `.cbz `__ + archives. extractor.sexcom.gifs diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index db367a9a..b04fb588 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -399,6 +399,7 @@ "token": "", "sleep-request": "0.5-1.5", + "cbz" : false, "format": ["0", "1600", "1280", "980", "780"], "tags" : false }, @@ -715,6 +716,7 @@ "token": "", "sleep-request": "0.5-1.5", + "cbz" : false, "format": ["0", "1600", "1280", "980", "780"], "tags" : false }, diff --git a/gallery_dl/extractor/schalenetwork.py b/gallery_dl/extractor/schalenetwork.py index a4ef3b09..5c9ec2f8 100644 --- a/gallery_dl/extractor/schalenetwork.py +++ b/gallery_dl/extractor/schalenetwork.py @@ -169,6 +169,20 @@ class SchalenetworkGalleryExtractor(SchalenetworkExtractor, GalleryExtractor): url = (f"{self.root_api}/books/data/{gid}/{gkey}" f"/{fmt['id']}/{fmt['key']}/{fmt['w']}?crt={self._crt()}") headers = self.headers + + if self.config("cbz", False): + headers["Authorization"] = self._token() + dl = self.request_json( + f"{url}&action=dl", method="POST", headers=headers) + # 'crt' parameter here is necessary for 'hdoujin' downloads + url = f"{dl['base']}?crt={self._crt()}" + info = text.nameext_from_url(url) + if "fallback" in dl: + info["_fallback"] = (dl["fallback"],) + if not info["extension"]: + info["extension"] = "cbz" + return ((url, info),) + data = self.request_json(url, headers=headers) base = data["base"]