mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
extension(mangafire): Added volume number in scanlator
This commit is contained in:
@@ -6,7 +6,7 @@ const mangayomiSources = [{
|
|||||||
"iconUrl": "https://mangafire.to/assets/sites/mangafire/favicon.png?v3",
|
"iconUrl": "https://mangafire.to/assets/sites/mangafire/favicon.png?v3",
|
||||||
"typeSource": "single",
|
"typeSource": "single",
|
||||||
"itemType": 0,
|
"itemType": 0,
|
||||||
"version": "0.1.21",
|
"version": "0.1.22",
|
||||||
"dateFormat": "",
|
"dateFormat": "",
|
||||||
"dateFormatLocale": "",
|
"dateFormatLocale": "",
|
||||||
"pkgPath": "manga/src/all/mangafire.js"
|
"pkgPath": "manga/src/all/mangafire.js"
|
||||||
@@ -106,17 +106,12 @@ class DefaultExtension extends MProvider {
|
|||||||
async getDetail(url) {
|
async getDetail(url) {
|
||||||
// get urls
|
// get urls
|
||||||
const id = url.split(".").pop();
|
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 = {};
|
const detail = {};
|
||||||
|
|
||||||
// request
|
// extract info
|
||||||
const idRes = await new Client().get(chapterUrl);
|
const infoUrl = this.source.baseUrl + url;
|
||||||
const idDoc = new Document(JSON.parse(idRes.body).result.html);
|
|
||||||
const infoRes = await new Client().get(infoUrl);
|
const infoRes = await new Client().get(infoUrl);
|
||||||
const infoDoc = new Document(infoRes.body);
|
const infoDoc = new Document(infoRes.body);
|
||||||
|
|
||||||
// extract info
|
|
||||||
const info = infoDoc.selectFirst("div.info");
|
const info = infoDoc.selectFirst("div.info");
|
||||||
const sidebar = infoDoc.select("aside.sidebar div.meta div");
|
const sidebar = infoDoc.select("aside.sidebar div.meta div");
|
||||||
detail.name = info.selectFirst("h1").text;
|
detail.name = info.selectFirst("h1").text;
|
||||||
@@ -130,7 +125,12 @@ class DefaultExtension extends MProvider {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// get chapter
|
// 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");
|
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 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 chapDoc = new Document(JSON.parse(chapRes.body).result);
|
||||||
const chapElements = chapDoc.selectFirst(".scroll-sm").children;
|
const chapElements = chapDoc.selectFirst(".scroll-sm").children;
|
||||||
@@ -138,6 +138,9 @@ class DefaultExtension extends MProvider {
|
|||||||
for (let i = 0; i < ids.length; i++) {
|
for (let i = 0; i < ids.length; i++) {
|
||||||
const name = ids[i].text;
|
const name = ids[i].text;
|
||||||
const id = ids[i].attr("data-id");
|
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}`;
|
const url = this.source.baseUrl + `/ajax/read/chapter/${id}`;
|
||||||
let dateUpload;
|
let dateUpload;
|
||||||
try {
|
try {
|
||||||
@@ -146,7 +149,7 @@ class DefaultExtension extends MProvider {
|
|||||||
dateUpload = null
|
dateUpload = null
|
||||||
}
|
}
|
||||||
|
|
||||||
detail.chapters.push({ name, url, dateUpload });
|
detail.chapters.push({ name, url, dateUpload,scanlator });
|
||||||
}
|
}
|
||||||
return detail;
|
return detail;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user