diff --git a/javascript/manga/src/all/mangafire.js b/javascript/manga/src/all/mangafire.js index 07dc4af1..00554a58 100644 --- a/javascript/manga/src/all/mangafire.js +++ b/javascript/manga/src/all/mangafire.js @@ -6,7 +6,7 @@ const mangayomiSources = [{ "iconUrl": "https://mangafire.to/assets/sites/mangafire/favicon.png?v3", "typeSource": "single", "itemType": 0, - "version": "0.1.21", + "version": "0.1.22", "dateFormat": "", "dateFormatLocale": "", "pkgPath": "manga/src/all/mangafire.js" @@ -106,17 +106,12 @@ class DefaultExtension extends MProvider { async getDetail(url) { // get urls const id = url.split(".").pop(); - const infoUrl = this.source.baseUrl + url; - const chapterUrl = this.source.baseUrl + `/ajax/read/${id}/chapter/${this.source.lang}`; const detail = {}; - // request - const idRes = await new Client().get(chapterUrl); - const idDoc = new Document(JSON.parse(idRes.body).result.html); + // extract info + const infoUrl = this.source.baseUrl + url; const infoRes = await new Client().get(infoUrl); const infoDoc = new Document(infoRes.body); - - // extract info const info = infoDoc.selectFirst("div.info"); const sidebar = infoDoc.select("aside.sidebar div.meta div"); detail.name = info.selectFirst("h1").text; @@ -130,7 +125,12 @@ class DefaultExtension extends MProvider { }); // get chapter + // /read/ is needed to get chapter details + const chapterUrl = this.source.baseUrl + `/ajax/read/${id}/chapter/${this.source.lang}`; + const idRes = await new Client().get(chapterUrl); + const idDoc = new Document(JSON.parse(idRes.body).result.html); const ids = idDoc.select("a"); + // /manga/ is needed to get chapter dateUpload const chapRes = await new Client().get(this.source.baseUrl + `/ajax/manga/${id}/chapter/${this.source.lang}`); const chapDoc = new Document(JSON.parse(chapRes.body).result); const chapElements = chapDoc.selectFirst(".scroll-sm").children; @@ -138,6 +138,9 @@ class DefaultExtension extends MProvider { for (let i = 0; i < ids.length; i++) { const name = ids[i].text; const id = ids[i].attr("data-id"); + var title = ids[i].attr("title").split(" - "); + var scanlator = title.length > 1 ? title[0] : "Vol 1" + const url = this.source.baseUrl + `/ajax/read/chapter/${id}`; let dateUpload; try { @@ -146,7 +149,7 @@ class DefaultExtension extends MProvider { dateUpload = null } - detail.chapters.push({ name, url, dateUpload }); + detail.chapters.push({ name, url, dateUpload,scanlator }); } return detail; }