From 94582496ef181603bf8f42d52269fb6cc6365fac Mon Sep 17 00:00:00 2001 From: Glax Date: Mon, 1 Apr 2024 20:00:02 +0200 Subject: [PATCH] Mangadex do not try downloading externally linked chapters, or chapters that have no pages. https://github.com/C9Glax/tranga/issues/153 --- Tranga/MangaConnectors/MangaDex.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tranga/MangaConnectors/MangaDex.cs b/Tranga/MangaConnectors/MangaDex.cs index aef00df..84b8891 100644 --- a/Tranga/MangaConnectors/MangaDex.cs +++ b/Tranga/MangaConnectors/MangaDex.cs @@ -216,6 +216,7 @@ public class MangaDex : MangaConnector { JsonObject chapter = (JsonObject)jsonNode!; JsonObject attributes = chapter["attributes"]!.AsObject(); + string chapterId = chapter["id"]!.GetValue(); string? title = attributes.ContainsKey("title") && attributes["title"] is not null @@ -230,6 +231,14 @@ public class MangaDex : MangaConnector ? attributes["chapter"]!.GetValue() : "null"; + + if (attributes.ContainsKey("pages") && attributes["pages"] is not null && + attributes["pages"]!.GetValue() < 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)); }