From 62d61e373d3f37fd71ebe0a8c32721f9b79af8b9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 29 Aug 2023 13:09:54 -0700 Subject: fix(mangadex): only count english chapters Improves chapter count accuracy by a lot! --- src/app.html | 11 +++++++---- src/lib/mangadex.ts | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/app.html b/src/app.html index c2d4576c..2ad032b3 100644 --- a/src/app.html +++ b/src/app.html @@ -3,10 +3,13 @@ - - - - + + + + 期限 diff --git a/src/lib/mangadex.ts b/src/lib/mangadex.ts index 8a3917e8..45251a4d 100644 --- a/src/lib/mangadex.ts +++ b/src/lib/mangadex.ts @@ -36,7 +36,13 @@ export const chapterCount = async (manga: Media): Promise => { return null; } - let lastChapter = lastChapterData['data'][0]['attributes']['chapter']; + let lastChapterIndex = 0; + + while (lastChapterData['data'][lastChapterIndex]['attributes']['translatedLanguage'] !== 'en') { + lastChapterIndex += 1; + } + + let lastChapter = lastChapterData['data'][lastChapterIndex]['attributes']['chapter']; if (lastChapter == 0) { lastChapter = null; -- cgit v1.2.3