Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create wnacg.com.js #64

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions repo/wnacg.com.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// ==MiruExtension==
// @name 紳士漫畫
// @version v0.0.1
// @author appdevelpo
// @lang zh-tw
// @license MIT
// @type manga
// @icon https://www.wnacg.com/favicon.ico
// @package wnacg.com
// @webSite https://www.wnacg.com
// @nsfw true
// ==/MiruExtension==

export default class Mangafx extends Extension {
async latest(page) {
const res = await this.request(`/albums-index-page-${page}.html`);
const bsxList = res.match(/<li class="li[\S\s]+?<\/li>/gm);
const mangas = [];
bsxList.forEach((element) => {
const url = element.match(/href="(.+?)"/)[1];
const title = element.match(/title="(.+?)"/)[1];
const cover = "https:"+element.match(/src="(.+?)"/)[1];
mangas.push({
title,
url,
cover,
});
});
return mangas;
}

async search(kw, page) {
const res = await this.request(`/search/index.php?q=${kw}&m=&syn=yes&f=_all&s=create_time_DESC&p=${page}`);
const bsxList = res.match(/<li class="li[\S\s]+?<\/li>/gm);
const mangas = [];
bsxList.forEach((element) => {
const url = element.match(/href="(.+?)"/)[1];
const title = element.match(/title="(.+?)"/)[1];
const cover = "https:"+element.match(/src="(.+?)"/)[1];
mangas.push({
title,
url,
cover,
});
});
return mangas;
}

async detail(url) {

const res = await this.request(url);
const titleRegex = /<h2>(.+?)<\/h2>/;
const titleMatch = res.match(titleRegex);
const title = titleMatch ? titleMatch[1] : null;
const coverRegex = /<img alt=".+src="\/\/(\/\/t4.+?)"/;
const coverMatch = "https:"+res.match(coverRegex)[1];
const cover = coverMatch ? coverMatch : null;
const descriptionRegex = /<p>([\s\S^]+?)<\/p>/;
const descriptionMatch = res.match(descriptionRegex);
const desc = descriptionMatch ? descriptionMatch[1] : null;

const button_match = res.match(/<a class="btn"[\s\S]+?<\/a>/g)
const id = button_match[0].match(/\d{6}/)[0];
return {
title: title || "Unknown Title",
cover: cover || "",
desc: desc || "No description available.",
episodes: [
{
title: "正常畫質",
urls: [{name:"1",url:`/photos-gallery-aid-${id}.html`}],
},
{
title: "低畫質",
urls: [{name:"1",url:`/photos-webp-aid-${id}.html`}],
}
],
};
}

async watch(url) {
const res = await this.request(url,{
headers: {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/237.84.2.178 Safari/537.36",
referer: "https://www.wnacg.com"}
});
const urls = []
const url_list = res.match(/\/\/img4.qy0.ru\/data.+?.jpg/g)
url_list.forEach((element) => {
urls.push("https:"+element)
})
return {
urls,
header: {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.142.86 Safari/537.36",
referer: "https://www.wnacg.com"
}
};
}
}