Skip to content

Commit

Permalink
Merge pull request #340 from Makhuta/cuttingedge
Browse files Browse the repository at this point in the history
Fix the Webtoons connector getting few chapters multiple times
  • Loading branch information
C9Glax authored Feb 11, 2025
2 parents e6d40a7 + 4ad3149 commit 9cef068
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Tranga/MangaConnectors/Webtoons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,16 @@ public override Chapter[] GetChapters(Manga manga, string language = "en")
return Array.Empty<Chapter>();

// 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>();

for(int page = 1; page <= pages; page++) {
string pageRequestUrl = $"{requestUrl}&page={page}";

chapters.AddRange(ParseChaptersFromHtml(manga, pageRequestUrl));
}

Log($"Got {chapters.Count} chapters. {manga}");
return chapters.Order().ToArray();
}
Expand Down

0 comments on commit 9cef068

Please sign in to comment.