mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-18 04:40:29 +00:00
+
This commit is contained in:
@@ -14,30 +14,30 @@ const mangayomiSources = [{
|
||||
"appMinVerReq": "0.4.0",
|
||||
"isNsfw": false,
|
||||
"hasCloudflare": false
|
||||
}];
|
||||
}];
|
||||
|
||||
class DefaultExtension extends MProvider {
|
||||
class DefaultExtension extends MProvider {
|
||||
getHeaders(url) {
|
||||
throw new Error("getHeaders not implemented");
|
||||
}
|
||||
|
||||
mangaListFromPage(res) {
|
||||
const doc = new Document(res.body);
|
||||
const mangaElements = doc.select("div.page-item-detail");
|
||||
const mangaElements = doc.select("div.mantine-grid-root > div.mantine-grid-col > div");
|
||||
const list = [];
|
||||
for (const element of mangaElements) {
|
||||
const name = element.selectFirst(".item-thumb > a").attr("title");
|
||||
const link = element.selectFirst(".item-thumb > a").getHref;
|
||||
const name = element.selectFirst("a > div > div > div.mantine-Text-root")?.text.trim();
|
||||
const link = this.source.baseUrl + element.selectFirst("a").getHref;
|
||||
const imageUrl = element.selectFirst("img").getSrc;
|
||||
list.push({ name, imageUrl, link });
|
||||
}
|
||||
const hasNextPage =
|
||||
doc.selectFirst("nav > div.nav-links > a").text?.includes("Posts") ?? false;
|
||||
const pagination = doc.select("button.mantine-y4zem1 > svg > path").map((el) => el.attr("d"));
|
||||
const hasNextPage = pagination.length > 1 ? pagination[1].startsWith("M8") : false;
|
||||
return { list: list, hasNextPage };
|
||||
}
|
||||
|
||||
toStatus(status) {
|
||||
if (status.includes("OnGoing")) return 0;
|
||||
if (status.includes("Ongoing")) return 0;
|
||||
else if (status.includes("Completed")) return 1;
|
||||
else if (status.includes("Hiatus")) return 2;
|
||||
else if (status.includes("Dropped")) return 3;
|
||||
@@ -46,20 +46,20 @@ const mangayomiSources = [{
|
||||
|
||||
async getPopular(page) {
|
||||
const res = await new Client().get(
|
||||
`${this.source.baseUrl}/manga-genre/novel/page/${page}/?m_orderby=trending`,
|
||||
`${this.source.baseUrl}/advance_search?order=-weekly_views&page=${page}`,
|
||||
);
|
||||
return this.mangaListFromPage(res);
|
||||
}
|
||||
|
||||
async getLatestUpdates(page) {
|
||||
const res = await new Client().get(
|
||||
`${this.source.baseUrl}/manga-genre/novel/page/${page}/?m_orderby=latest`,
|
||||
`${this.source.baseUrl}/advance_search?order=-created_at&page=${page}`,
|
||||
);
|
||||
return this.mangaListFromPage(res);
|
||||
}
|
||||
|
||||
async search(query, page, filters) {
|
||||
let url = `${this.source.baseUrl}/?s=${query}`;
|
||||
let url = `${this.source.baseUrl}/advance_search?order=&page=${page}&search=${encodeURI(query)}`;
|
||||
const res = await new Client().get(url);
|
||||
return this.mangaListFromPage(res);
|
||||
}
|
||||
@@ -68,32 +68,22 @@ const mangayomiSources = [{
|
||||
const client = new Client();
|
||||
const res = await client.get(url);
|
||||
const doc = new Document(res.body);
|
||||
const imageUrl = doc.selectFirst("div.summary_image > a > img")?.getSrc;
|
||||
const description = doc.select("div.summary__content > p > span").map((el) => el.text).join(" ");
|
||||
const author = doc.selectFirst("div.author-content > a")?.text.trim();
|
||||
const artist = doc.selectFirst("div.artist-content > a")?.text.trim();
|
||||
const status = this.toStatus(doc.selectFirst("div.post-status > div.post-content_item > div.summary-content")?.text.trim());
|
||||
const tags = doc.select("div.summary-content > div.tags-content > a").map((el) => el.text.trim());
|
||||
let genre = doc.select("div.summary-content > div.genres-content > a").map((el) => el.text.trim());
|
||||
if (tags.length != 0) {
|
||||
genre.push(tags);
|
||||
}
|
||||
const imageUrl = doc.selectFirst("figure > div > img")?.getSrc;
|
||||
const description = doc.select("div.mantine-Spoiler-root > div > div > div.mantine-Text-root")?.text.trim();
|
||||
const author = doc.selectFirst("div.mantine-lqk3v2 > div")?.text.trim();
|
||||
const status = this.toStatus(doc.selectFirst("div.mantine-1uxmzbt > div.mantine-1huvzos")?.text.trim());
|
||||
const genre = doc.select("div.mantine-bl3g33 > div > a > div > div > span").map((el) => el.text.trim());
|
||||
|
||||
const chapters = [];
|
||||
const chapterRes = await client.post(`${url}ajax/chapters/`, {
|
||||
Priority: "u=0, i",
|
||||
"Origin": this.source.baseUrl,
|
||||
"Referer": url,
|
||||
});
|
||||
const chapterDoc = new Document(chapterRes.body);
|
||||
|
||||
const chapterElements = chapterDoc.select("li.free-chap");
|
||||
const chapterElements = doc.select("div.mantine-1x5ubwi > div");
|
||||
for (const el of chapterElements) {
|
||||
let chapterName = el.selectFirst("a")?.text.trim();
|
||||
const chapterUrl = el.selectFirst("a").getHref;
|
||||
let chapterName = el.selectFirst("div.mantine-Group-root > div > a > div > h4")?.text.trim();
|
||||
if (!chapterName) {
|
||||
continue;
|
||||
}
|
||||
const chapterUrl = this.source.baseUrl + el.selectFirst("div.mantine-Group-root > div > a").getHref;
|
||||
let dateUpload;
|
||||
try {
|
||||
dateUpload = this.parseDate(el.selectFirst("span.chapter-release-date > i")?.text.trim());
|
||||
dateUpload = this.parseDate(el.selectFirst("div > a > div > div > div.mantine-Text-root")?.text.trim());
|
||||
} catch (_) {
|
||||
dateUpload = null;
|
||||
}
|
||||
@@ -123,9 +113,9 @@ const mangayomiSources = [{
|
||||
const res = await client.get(url);
|
||||
const doc = new Document(res.body);
|
||||
const title =
|
||||
doc.selectFirst("#chapter-heading")?.text.trim() ||
|
||||
doc.selectFirst("div.mantine-Center-root > h1.mantine-Title-root")?.text.trim() ||
|
||||
"";
|
||||
const content = doc.selectFirst(".entry-content")?.innerHtml;
|
||||
const content = doc.select("div.mantine-Container-root > div.mantine-Paper-root > div")[2]?.innerHtml;
|
||||
return `<h2>${title}</h2><hr><br>${content}`;
|
||||
}
|
||||
|
||||
@@ -153,4 +143,4 @@ const mangayomiSources = [{
|
||||
date = date.join("-");
|
||||
return String(new Date(date).valueOf());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user