From aef1565443e9be9d17b8775d57ca72707653b21b Mon Sep 17 00:00:00 2001 From: yangyuhou <2269198325@qq.com> Date: Thu, 5 Dec 2024 11:04:40 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=8A=A0=E8=BD=BD=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- repo/asuratoon.com.js | 80 ++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 23 deletions(-) diff --git a/repo/asuratoon.com.js b/repo/asuratoon.com.js index 05bfe8b..53066f8 100644 --- a/repo/asuratoon.com.js +++ b/repo/asuratoon.com.js @@ -46,7 +46,9 @@ export default class extends Extension { const html = await element.content; const url = await this.getAttributeText(html, "a", "href"); const title = await this.querySelector(html, "span.block").text; - const cover = await this.querySelector(html, "img").getAttributeText("src"); + const cover = await this.querySelector(html, "img").getAttributeText( + "src" + ); comic.push({ title: title.trim(), @@ -59,14 +61,22 @@ export default class extends Extension { async search(kw, page) { const res = await this.req(`/series?page=${page}&name=${kw}`); - const searchList = await this.querySelectorAll(res, "div.grid.grid-cols-2.sm\\:grid-cols-2.md\\:grid-cols-5.gap-3.p-4 > a"); + const searchList = await this.querySelectorAll( + res, + "div.grid.grid-cols-2.sm\\:grid-cols-2.md\\:grid-cols-5.gap-3.p-4 > a" + ); const result = await Promise.all( searchList.map(async (element) => { const html = await element.content; const url = await this.getAttributeText(html, "a", "href"); - const title = await this.querySelector(html, "span.block.text-\\[13\\.3px\\].font-bold").text; - const cover = await this.querySelector(html, "img").getAttributeText("src"); + const title = await this.querySelector( + html, + "span.block.text-\\[13\\.3px\\].font-bold" + ).text; + const cover = await this.querySelector(html, "img").getAttributeText( + "src" + ); return { title: title.trim(), @@ -86,16 +96,35 @@ export default class extends Extension { }, }); - const title = await this.querySelector(res, "div.text-center.sm\\:text-left span.text-xl.font-bold").text; - const cover = await this.querySelector(res, "img[alt='poster']").getAttributeText("src"); - const desc = await this.querySelector(res, "span.font-medium.text-sm.text-\\[\\#A2A2A2\\]").text; - - const epiList = await this.querySelectorAll(res, "div.pl-4.pr-2.pb-4.overflow-y-auto > div"); + const title = await this.querySelector( + res, + "div.text-center.sm\\:text-left span.text-xl.font-bold" + ).text; + const cover = await this.querySelector( + res, + "img[alt='poster']" + ).getAttributeText("src"); + const desc = await this.querySelector( + res, + "span.font-medium.text-sm.text-\\[\\#A2A2A2\\]" + ).text; + + const epiList = await this.querySelectorAll( + res, + "div.pl-4.pr-2.pb-4.overflow-y-auto > div" + ); const episodes = await Promise.all( epiList.map(async (element) => { const html = await element.content; - const name = await this.querySelector(html, "h3.text-sm.text-white.font-medium a").text; - const url = await this.getAttributeText(html, "h3.text-sm.text-white.font-medium a", "href"); + const name = await this.querySelector( + html, + "h3.text-sm.text-white.font-medium a" + ).text; + const url = await this.getAttributeText( + html, + "h3.text-sm.text-white.font-medium a", + "href" + ); return { name: name.trim(), url: url, @@ -121,24 +150,29 @@ export default class extends Extension { } async watch(url) { - const res = await this.request('', { + console.log(url + " url"); + + const res = await this.request("", { headers: { "Miru-Url": "https://asuracomic.net/series/" + url, - "referer": "https://asuracomic.net/", - "origin": "https://asuracomic.net", - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36", + referer: "https://asuracomic.net/", + origin: "https://asuracomic.net", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36", }, }); - - const images = await Promise.all( - (await this.querySelectorAll(res, "div.w-full.mx-auto.center > img")).map(async (element) => { - const html = await element.content; - return this.getAttributeText(html, "img", "src"); - }) - ); + const regex = /