diff options
| author | Fuwn <[email protected]> | 2023-08-29 13:09:54 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-08-29 13:09:54 -0700 |
| commit | 62d61e373d3f37fd71ebe0a8c32721f9b79af8b9 (patch) | |
| tree | 2b9c3e9de561b34b581030c7e36b8d8a162ba5d2 /src/lib | |
| parent | fix(app.html): png image (diff) | |
| download | due.moe-62d61e373d3f37fd71ebe0a8c32721f9b79af8b9.tar.xz due.moe-62d61e373d3f37fd71ebe0a8c32721f9b79af8b9.zip | |
fix(mangadex): only count english chapters
Improves chapter count accuracy by a lot!
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/mangadex.ts | 8 |
1 files changed, 7 insertions, 1 deletions
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<number | null> => { 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; |