Skip to content
This repository was archived by the owner on Mar 23, 2025. It is now read-only.

Commit 0f6b0b6

Browse files
authored
Merge pull request #23 from dertasiu/master
Extend the non-english name fix to selectChapter, newChapters and listChapters functions
2 parents 1c3d65d + 6753a08 commit 0f6b0b6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

plugins/mangadex/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ function searchManga(query) {
7272

7373
function listChapters(id) {
7474
const manga = getManga(id);
75-
const title = manga.attributes.title.en;
75+
const titleAttr = manga.attributes.title;
76+
const title = titleAttr.en || titleAttr['ja-ro'] || titleAttr[Object.keys(titleAttr)[0]];
7677

7778
var url = 'https://api.mangadex.org/manga/' + id + '/feed?';
7879

@@ -121,7 +122,8 @@ function newChapters(mangaId, after) {
121122
const chapters = JSON.parse(res.body).data;
122123

123124
const manga = getManga(mangaId);
124-
const title = manga.attributes.title.en;
125+
const titleAttr = manga.attributes.title;
126+
const title = titleAttr.en || titleAttr['ja-ro'] || titleAttr[Object.keys(titleAttr)[0]];
125127

126128
return JSON.stringify(chapters.map(function(ch) {
127129
return formatChapter(ch, title);
@@ -147,7 +149,8 @@ function selectChapter(id) {
147149
mango.raise('Failed to get Manga ID from chapter');
148150

149151
const manga = getManga(mangaId);
150-
const title = manga.attributes.title.en;
152+
const titleAttr = manga.attributes.title;
153+
const title = titleAttr.en || titleAttr['ja-ro'] || titleAttr[Object.keys(titleAttr)[0]];
151154

152155
const atHome = mango.get('https://api.mangadex.org/at-home/server/' + id);
153156
if (atHome.status_code !== 200)

0 commit comments

Comments
 (0)