Skip to content

Commit

Permalink
Mangadex do not try downloading externally linked chapters, or chapte…
Browse files Browse the repository at this point in the history
…rs that have no pages.

#153
  • Loading branch information
C9Glax committed Apr 1, 2024
1 parent 17ef5ea commit 9458249
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Tranga/MangaConnectors/MangaDex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ public override Chapter[] GetChapters(Manga manga, string language="en")
{
JsonObject chapter = (JsonObject)jsonNode!;
JsonObject attributes = chapter["attributes"]!.AsObject();

string chapterId = chapter["id"]!.GetValue<string>();

string? title = attributes.ContainsKey("title") && attributes["title"] is not null
Expand All @@ -230,6 +231,14 @@ public override Chapter[] GetChapters(Manga manga, string language="en")
? attributes["chapter"]!.GetValue<string>()
: "null";


if (attributes.ContainsKey("pages") && attributes["pages"] is not null &&
attributes["pages"]!.GetValue<int>() < 1)
{
Log($"Skipping {chapterId} Vol.{volume} Ch.{chapterNum} {title} because it has no pages or is externally linked.");
continue;
}

if(chapterNum is not "null")
chapters.Add(new Chapter(manga, title, volume, chapterNum, chapterId));
}
Expand Down

0 comments on commit 9458249

Please sign in to comment.