This commit is contained in:
Ftbom
2024-05-04 14:11:32 +00:00
parent fade24ed1a
commit 9504fead9c
4 changed files with 1465 additions and 1453 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

@@ -149,6 +149,7 @@ const mangayomiSources = [{
url: element.attr("href") url: element.attr("href")
}); });
} }
chapters.reverse();
return { return {
name: title, name: title,
imageUrl: cover, imageUrl: cover,

View File

@@ -3,7 +3,7 @@ const mangayomiSources = [{
"lang": "zh", "lang": "zh",
"baseUrl": "https://www.manhuadb.com", "baseUrl": "https://www.manhuadb.com",
"apiUrl": "", "apiUrl": "",
"iconUrl": "https://www.manhuadb.com/assets/www/img/favicon.png", "iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/zh.manhuadb.png",
"typeSource": "single", "typeSource": "single",
"isManga": true, "isManga": true,
"isNsfw": false, "isNsfw": false,

View File

@@ -117,6 +117,10 @@ const mangayomiSources = [{
} }
class DefaultExtension extends MProvider { class DefaultExtension extends MProvider {
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
};
getHeaders(url) { getHeaders(url) {
return { return {
Referer: this.source.baseUrl Referer: this.source.baseUrl
@@ -124,7 +128,7 @@ const mangayomiSources = [{
} }
async getItems(url, p) { async getItems(url, p) {
const res = await new Client().get(this.source.baseUrl + url); const res = await new Client().get(this.source.baseUrl + url, this.headers);
const doc = new Document(res.body); const doc = new Document(res.body);
const mangas = []; const mangas = [];
const elements = doc.select(p); const elements = doc.select(p);
@@ -173,14 +177,14 @@ const mangayomiSources = [{
} }
} }
const params = [locations, categories, reader, status]; const params = [locations, categories, reader, status];
return await this.getItems(`/list${"/"+params.filter(item => item != "").join("_")}/update_p${page}.html`, "ul#contList li"); return await this.getItems(`/list${"/"+params.filter(item => item != "").join("_")}/${sort}_p${page}.html`, "ul#contList li");
} else { } else {
return await this.getItems(`/s/${query}_p${page}.html`, "div.book-result li"); return await this.getItems(`/s/${query}_p${page}.html`, "div.book-result li");
} }
} }
async getDetail(url) { async getDetail(url) {
const res = await new Client().get(this.source.baseUrl + url); const res = await new Client().get(this.source.baseUrl + url, this.headers);
const doc = new Document(res.body); const doc = new Document(res.body);
const title = doc.selectFirst("div.book-title h1").text; const title = doc.selectFirst("div.book-title h1").text;
const cover = "https:" + doc.selectFirst("p.hcover img").attr("src"); const cover = "https:" + doc.selectFirst("p.hcover img").attr("src");
@@ -204,16 +208,23 @@ const mangayomiSources = [{
chapter_html = new Document(text); chapter_html = new Document(text);
} }
const ch_title = chapter_html.select("h4 span"); const ch_title = chapter_html.select("h4 span");
const chapters = chapter_html.select("div#chapter-list-0") const chapters = chapter_html.select("div.chapter-list")
var index = 0; var index = 0;
for (const chs of ch_title) { for (const chs of ch_title) {
const t = chs.text; const t = chs.text;
for (const ch of chapters[index].select("a.status0")) { for (const ch of chapters[index].select("ul")) {
eps.push({ const ep_ = [];
name: `|${t}|` + ch.attr("title"), for (const c of ch.select("a.status0")) {
url: ch.attr("href") ep_.push({
name: `|${t}|` + c.attr("title"),
url: c.attr("href")
}); });
} }
ep_.reverse();
for (const e of ep_) {
eps.push(e);
}
}
index = index + 1; index = index + 1;
} }
return { return {
@@ -230,7 +241,7 @@ const mangayomiSources = [{
async getPageList(url) { async getPageList(url) {
const preference = new SharedPreferences(); const preference = new SharedPreferences();
const image_host = preference.get("imghost"); const image_host = preference.get("imghost");
const res = await new Client().get(this.source.baseUrl + url); const res = await new Client().get(this.source.baseUrl + url, this.headers);
const datas = decode(res.body); const datas = decode(res.body);
const imgs = []; const imgs = [];
for (const data of datas["files"]) { for (const data of datas["files"]) {