[schalenetwork][hdoujin] re-implement 'cbz' option (#8431)
This commit is contained in:
@@ -3284,6 +3284,19 @@ Description
|
|||||||
Recursively download files from subfolders.
|
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
|
extractor.hdoujin.crt
|
||||||
---------------------
|
---------------------
|
||||||
Type
|
Type
|
||||||
@@ -3345,7 +3358,10 @@ Example
|
|||||||
Description
|
Description
|
||||||
``Authorization`` header value
|
``Authorization`` header value
|
||||||
used for requests to ``https://api.hdoujin.org``
|
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
|
extractor.hentaifoundry.descriptions
|
||||||
@@ -5163,6 +5179,19 @@ Description
|
|||||||
Download videos.
|
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
|
extractor.schalenetwork.crt
|
||||||
---------------------------
|
---------------------------
|
||||||
Type
|
Type
|
||||||
@@ -5227,7 +5256,10 @@ Example
|
|||||||
Description
|
Description
|
||||||
``Authorization`` header value
|
``Authorization`` header value
|
||||||
used for requests to ``https://api.schale.network``
|
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
|
extractor.sexcom.gifs
|
||||||
|
|||||||
@@ -399,6 +399,7 @@
|
|||||||
"token": "",
|
"token": "",
|
||||||
"sleep-request": "0.5-1.5",
|
"sleep-request": "0.5-1.5",
|
||||||
|
|
||||||
|
"cbz" : false,
|
||||||
"format": ["0", "1600", "1280", "980", "780"],
|
"format": ["0", "1600", "1280", "980", "780"],
|
||||||
"tags" : false
|
"tags" : false
|
||||||
},
|
},
|
||||||
@@ -715,6 +716,7 @@
|
|||||||
"token": "",
|
"token": "",
|
||||||
"sleep-request": "0.5-1.5",
|
"sleep-request": "0.5-1.5",
|
||||||
|
|
||||||
|
"cbz" : false,
|
||||||
"format": ["0", "1600", "1280", "980", "780"],
|
"format": ["0", "1600", "1280", "980", "780"],
|
||||||
"tags" : false
|
"tags" : false
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -169,6 +169,20 @@ class SchalenetworkGalleryExtractor(SchalenetworkExtractor, GalleryExtractor):
|
|||||||
url = (f"{self.root_api}/books/data/{gid}/{gkey}"
|
url = (f"{self.root_api}/books/data/{gid}/{gkey}"
|
||||||
f"/{fmt['id']}/{fmt['key']}/{fmt['w']}?crt={self._crt()}")
|
f"/{fmt['id']}/{fmt['key']}/{fmt['w']}?crt={self._crt()}")
|
||||||
headers = self.headers
|
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)
|
data = self.request_json(url, headers=headers)
|
||||||
base = data["base"]
|
base = data["base"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user