[koharu] fix 'count' for 'cbz' downloads (#5893)
This commit is contained in:
@@ -60,6 +60,7 @@ class KoharuGalleryExtractor(KoharuExtractor, GalleryExtractor):
|
||||
filename_fmt = "{num:>03}.{extension}"
|
||||
directory_fmt = ("{category}", "{id} {title}")
|
||||
archive_fmt = "{id}_{num}"
|
||||
request_interval = 0.0
|
||||
pattern = BASE_PATTERN + r"/(?:g|reader)/(\d+)/(\w+)"
|
||||
example = "https://koharu.to/g/12345/67890abcde/"
|
||||
|
||||
@@ -101,8 +102,6 @@ class KoharuGalleryExtractor(KoharuExtractor, GalleryExtractor):
|
||||
url = "{}/books/detail/{}/{}".format(
|
||||
self.root_api, self.groups[0], self.groups[1])
|
||||
self.data = data = self.request(url, headers=self.headers).json()
|
||||
data.pop("rels", None)
|
||||
data.pop("thumbnails", None)
|
||||
|
||||
tags = []
|
||||
for tag in data["tags"]:
|
||||
@@ -112,6 +111,14 @@ class KoharuGalleryExtractor(KoharuExtractor, GalleryExtractor):
|
||||
data["tags"] = tags
|
||||
data["date"] = text.parse_timestamp(data["created_at"] // 1000)
|
||||
|
||||
try:
|
||||
if self.cbz:
|
||||
data["count"] = len(data["thumbnails"]["entries"])
|
||||
del data["thumbnails"]
|
||||
del data["rels"]
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return data
|
||||
|
||||
def images(self, _):
|
||||
|
||||
@@ -15,7 +15,7 @@ __tests__ = (
|
||||
"#pattern" : r"https://kisakisexo.xyz/download/59896/a4fbd1828229/f47639c6abaf1903dd69c36a3d961da84741a1831aa07a2906ce9c74156a5d75\?v=1721626410802&w=0",
|
||||
"#count" : 1,
|
||||
|
||||
"count" : 1,
|
||||
"count" : 22,
|
||||
"created_at": 1721626410802,
|
||||
"date" : "dt:2024-07-22 05:33:30",
|
||||
"extension" : "cbz",
|
||||
|
||||
Reference in New Issue
Block a user