[schalenetwork][hdoujin] re-implement 'cbz' option (#8431)

This commit is contained in:
Mike Fährmann
2025-10-18 20:57:58 +02:00
parent 9ad937a982
commit 11ccadfd8c
3 changed files with 50 additions and 2 deletions

View File

@@ -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.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 <extractor.hdoujin.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.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 <extractor.schalenetwork.cbz_>`__
archives.
extractor.sexcom.gifs

View File

@@ -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
},

View File

@@ -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"]