Skip to content

Commit

Permalink
[weebcentral] fix extracting wrong number of chapter pages (#6966)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mikf committed Feb 10, 2025
1 parent 587205b commit be77465
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
16 changes: 9 additions & 7 deletions gallery_dl/extractor/weebcentral.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 15 additions & 0 deletions test/results/weebcentral.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@
],
},

{
"#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,
Expand Down

0 comments on commit be77465

Please sign in to comment.