- fixed when parsing chapters the pages was incorrectly parsed resulting into adding the chapters from the last page multiple times (was still downloading OK but it would try to download the chapters from last page multiple times)
This commit is contained in:
Makhuta 2025-02-11 20:16:30 +01:00
parent e6d40a7b36
commit 4ad3149523

View File

@ -154,15 +154,16 @@ public class Webtoons : MangaConnector
return Array.Empty<Chapter>(); return Array.Empty<Chapter>();
// Get number of pages // Get number of pages
int pages = requestResult.htmlDocument.DocumentNode.SelectSingleNode("//div[contains(@class, 'paginate')]").ChildNodes.ToArray().Length; int pages = requestResult.htmlDocument.DocumentNode
.SelectNodes("//div[contains(@class, 'paginate')]/a")
.ToList()
.Count;
List<Chapter> chapters = new List<Chapter>(); List<Chapter> chapters = new List<Chapter>();
for(int page = 1; page <= pages; page++) { for(int page = 1; page <= pages; page++) {
string pageRequestUrl = $"{requestUrl}&page={page}"; string pageRequestUrl = $"{requestUrl}&page={page}";
chapters.AddRange(ParseChaptersFromHtml(manga, pageRequestUrl)); chapters.AddRange(ParseChaptersFromHtml(manga, pageRequestUrl));
} }
Log($"Got {chapters.Count} chapters. {manga}"); Log($"Got {chapters.Count} chapters. {manga}");
return chapters.Order().ToArray(); return chapters.Order().ToArray();
} }