Skip to content

Commit

Permalink
Merge pull request #331 from YuJunZhiXue/YuJunXue
Browse files Browse the repository at this point in the history
提交最新的修改,修复页面不显示问题,添加作者信息(Submit the latest changes, fix the page not displaying problem, add author information)
  • Loading branch information
OshekharO authored Dec 6, 2024
2 parents 54382d9 + 3673817 commit d2fac44
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 23 deletions.
79 changes: 56 additions & 23 deletions repo/asuratoon.com.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==MiruExtension==
// @name AsuraScan
// @version v0.0.3
// @version v0.0.5
// @author bethro
// @lang en
// @license MIT
Expand Down Expand Up @@ -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(),
Expand All @@ -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(),
Expand All @@ -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,
Expand All @@ -121,24 +150,28 @@ 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",
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 = /<script>(.*?)\<\/script>/gs;
const matches = res.match(regex);
const pageRegex = /\\"pages\\":\[(.*?)\]/gs;
const pageMatches = matches.join("").match(pageRegex);
//console.log(pageMatches + "pageMatches");
const httpRegex = /https:\/\/[^\\]+/g;
const httpMatches = pageMatches.join("").match(httpRegex);
//console.log(httpMatches.length + "httpMatches.length");
//console.log(httpMatches + "httpMatches");

return {
urls: images,
urls: httpMatches,
};
}
}
112 changes: 112 additions & 0 deletions repo/gufengmh.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// ==MiruExtension==
// @name 古风漫画
// @version v0.0.1
// @author 瑜君之学-杨瑜候
// @lang zh
// @license MIT
// @type manga
// @icon https://www.gufengmh.com/favicon.ico
// @package gufengmh
// @webSite https://www.gufengmh.com
// @nsfw false
// ==/MiruExtension==

export default class extends Extension {
async latest(page) {
const res = await this.request(`/list/click/?page=${page}`);
const bsxList = await this.querySelectorAll(res, "li.item-lg");
const novel = await Promise.all(
bsxList.map(async (element) => {
const html = await element.content;
const img = await this.getAttributeText(html, "img", "src");
const upImg = img.replace("webp", "jpg");
return {
title: await this.getAttributeText(html, "img", "alt"),
url: await this.getAttributeText(html, "a", "href"),
img: upImg,
};
})
);

return novel;
}

async search(keyword, page) {
const res = await this.request(`/search/?keywords=${keyword}&page=${page}`);
const bsxList = await this.querySelectorAll(res, "li.item-lg");

const lieBiao = await Promise.all(
bsxList.map(async (element) => {
const html = await element.content;
const img = await this.getAttributeText(html, "img", "src");
const upImg = img.replace("webp", "jpg");
return {
title: await this.getAttributeText(html, "img", "alt"),
url: await this.getAttributeText(html, "a", "href"),
img: upImg,
};
})
);
return lieBiao;
}

async detail(url) {
const res = await this.request("", { headers: { "Miru-Url": url } });

const coverTitle =
(await this.querySelector(res, ".book-title > h1 > span")?.text) ?? "";
const coverImg = await this.getAttributeText(
res,
"div.book-cover > p > img",
"src"
);
const coverDesc =
(await this.querySelector(res, "#intro-all > p")?.text) ?? "";
const selectList = await this.querySelectorAll(
res,
"div.chapter-body > ul > li"
);
const muLuDAta = [];
for (const element of selectList) {
const html = element.content;
const title = await this.querySelector(html, "span").text;
const url = await this.getAttributeText(html, "a", "href");
muLuDAta.push({
name: title,
url: url,
});
}

return {
title: coverTitle,
cover: coverImg,
coverDesc,
episodes: [
{
title: "Directory",
urls: muLuDAta,
},
],
};
}

async watch(url) {
const res = await this.request(url);

const chapterImagesMatch = res.match(/var chapterImages = \[(.*?)\];/s);
const chapterPathMatch = res.match(/var chapterPath = "([^"]+)";/);

if (chapterImagesMatch && chapterPathMatch) {
const chapterImages = chapterImagesMatch[1]
.split(",")
.map((item) => item.replace(/["\s]/g, ""));
const chapterPath = chapterPathMatch[1];

return {
urls: chapterImages.map(
(image) => `https://res.xiaoqinre.com/${chapterPath}${image}`
),
};
}
}
}

0 comments on commit d2fac44

Please sign in to comment.