[weebcentral] fix extracting wrong number of chapter pages (#6966)

When downloading multiple chapters at once, all chapters after the first
one would download only as many pages per chapter as the first one had,
due to reusing a cached/shared dict in the wrong way.
This commit is contained in:
Mike Fährmann
2025-02-10 16:00:13 +01:00
parent 587205bf68
commit be77465e1b
2 changed files with 24 additions and 7 deletions

View File

@@ -50,14 +50,16 @@ class WeebcentralChapterExtractor(WeebcentralBase, ChapterExtractor):
def metadata(self, page):
extr = text.extract_from(page)
manga_id = extr("'series_id': '", "'")
data = self._extract_manga_data(manga_id)
data["chapter_id"] = self.groups[1]
data["chapter_type"] = extr("'chapter_type': '", "'")
chapter_type = extr("'chapter_type': '", "'")
chapter, sep, minor = extr("'number': '", "'").partition(".")
data["chapter"] = text.parse_int(chapter)
data["chapter_minor"] = sep + minor
data = {
"chapter": text.parse_int(chapter),
"chapter_id": self.groups[1],
"chapter_type": chapter_type,
"chapter_minor": sep + minor,
}
data.update(self._extract_manga_data(manga_id))
return data

View File

@@ -44,6 +44,21 @@ __tests__ = (
],
},
{
"#url" : "https://weebcentral.com/chapters/01J76XZ4PBJFDFCQA6NQP4HDNJ",
"#comment" : "wrong page count after chapter with less pages (#6966)",
"#class" : weebcentral.WeebcentralChapterExtractor,
"#pattern" : r"https://official\.lowee\.us/manga/Aria/0001-0\d\d\.png",
"#count" : 42,
"chapter" : 1,
"chapter_id" : "01J76XZ4PBJFDFCQA6NQP4HDNJ",
"chapter_minor": "",
"chapter_type" : "Navigation",
"count" : 42,
"page" : range(1, 42),
},
{
"#url" : "https://weebcentral.com/series/01J76XY8G1GK8EJ9VQG92C3DKM/Aria",
"#class" : weebcentral.WeebcentralMangaExtractor,