From 87de1485768af9ff6016c6c9cd2d0d8d92fd5036 Mon Sep 17 00:00:00 2001 From: appdevelpo <56633229+appdevelpo@users.noreply.github.com> Date: Fri, 20 Oct 2023 22:17:36 +0800 Subject: [PATCH] Update manhuagui.com.js --- repo/manhuagui.com.js | 71 +++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/repo/manhuagui.com.js b/repo/manhuagui.com.js index 2e38e81..cb66ec8 100644 --- a/repo/manhuagui.com.js +++ b/repo/manhuagui.com.js @@ -1,6 +1,6 @@ // ==MiruExtension== // @name 漫画柜 -// @version v0.0.1 +// @version v0.0.2 // @author appdevelpo // @lang zh-cn // @license MIT @@ -10,49 +10,54 @@ // @webSite https://api-manhuagui.aoihosizora.top/v1 // @nsfw false // ==/MiruExtension== -export default class Mangafx extends Extension { +export default class extends Extension { async latest(page) { const res = await this.request("", { headers: { "Miru-Url": "https://www.manhuagui.com/update/d30.html", }, }); - const bsxList = res.match(/
  • [\s\S]?/g); - const mangas = []; - bsxList.forEach((element) => { - const url = element.match(/src="\/\/cf.mhgui.com\/cpic\/m\/(\d+)/)[1]; - const title = element.match(/title="(.+?)"/)[1]; - const cover = "https:"+element.match(/src="(.+?)"/)[1]; - mangas.push({ - title, - url, - cover, + const bsxList = res.match(/
  • [\s\S]?/g); + const mangas = []; + + bsxList.forEach((element) => { + const url_match = element.match(/href="\/comic\/(\d+)/); + const url = url_match ? url_match[1] : ""; + + const title_match = element.match(/title="(.+?)"/); + const title = title_match ? title_match[1] : null; + const coverMatch = element.match(/src="(.+?)"/); + const cover = coverMatch ? "https:" + coverMatch[1] : ""; + mangas.push({ + title, + url, + cover, + }); }); - }); - return mangas; + return mangas; } - + async search(kw, page) { const res = await this.request("", { headers: { "Miru-Url": `https://www.manhuagui.com/s/${kw}.html`, }, }); - const bsxList = res.match(/
  • [\s\S]+?<\/li>/g); - const mangas = []; - bsxList.forEach((element) => { - const url = element.match(/href="\/comic\/(\d+)/)[1]; - const title = element.match(/title="(.+?)"/)[1]; - const cover = "https:"+element.match(/src="(.+?)"/)[1]; - mangas.push({ - title, - url, - cover, + const bsxList = res.match(/
  • [\s\S]+?<\/li>/g); + const mangas = []; + bsxList.forEach((element) => { + const url = element.match(/href="\/comic\/(\d+)/)[1]; + const title = element.match(/title="(.+?)"/)[1]; + const cover = "https:" + element.match(/src="(.+?)"/)[1]; + mangas.push({ + title, + url, + cover, + }); }); - }); - return mangas; + return mangas; } - + async detail(url) { const res = await this.request(`/manga/${url}`); const dat = res.data; @@ -71,16 +76,16 @@ export default class Mangafx extends Extension { ], }; } - + async watch(url) { const res = await this.request(`/manga/${url}`); return { urls: res.data.pages, - headers:{ + headers: { "Referer": "https://tw.manhuagui.com/", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.56" - } + } }; } - } - +} +