fix chapter date

This commit is contained in:
kodjomoustapha
2024-11-05 17:27:09 +01:00
parent 8bdedff5a5
commit 12d9e194b2

View File

@@ -104,7 +104,7 @@ class DefaultExtension extends MProvider {
// get urls // get urls
const id = url.split(".").pop(); const id = url.split(".").pop();
const infoUrl = this.source.baseUrl + url; const infoUrl = this.source.baseUrl + url;
const chapterUrl = `https://mangafire.to/ajax/read/${id}/chapter/${this.source.lang}`; const chapterUrl = this.source.baseUrl + `/ajax/read/${id}/chapter/${this.source.lang}`;
const detail = {}; const detail = {};
// request // request
@@ -128,14 +128,22 @@ class DefaultExtension extends MProvider {
// get chapter // get chapter
const ids = idDoc.select("a"); const ids = idDoc.select("a");
const dates = infoDoc.select("div.list-body > ul.scroll-sm > li > a > span + span"); 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;
detail.chapters = []; detail.chapters = [];
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");
const url = `https://mangafire.to/ajax/read/chapter/${id}`; const url = this.source.baseUrl + `/ajax/read/chapter/${id}`;
const dateUpload = this.parseDate(dates[i].text); let dateUpload;
detail.chapters.push({name, url, dateUpload}); try {
dateUpload = this.parseDate(chapElements[i].selectFirst("span + span").text);
} catch (_) {
dateUpload = null
}
detail.chapters.push({ name, url, dateUpload });
} }
return detail; return detail;
} }