rsshub
Version:
Make RSS Great Again!
78 lines (76 loc) • 2.27 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./logger-Czu8UMNd.mjs";
import { t as art } from "./render-BQo6B4tL.mjs";
import "./proxy-Db7uGcYb.mjs";
import { n as puppeteer_default } from "./puppeteer-DGmvuGvT.mjs";
import path from "node:path";
import * as cheerio from "cheerio";
//#region lib/routes/missav/new.ts
init_esm_shims();
const urlPath = "dm514/new";
const route = {
path: "/new",
categories: ["multimedia"],
example: "/missav/new",
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
nsfw: true
},
radar: [{ source: [
`missav.ws/${urlPath}`,
"missav.ws/new",
"missav.ws/"
] }, { source: [
`missav.ai/${urlPath}`,
"missav.ai/new",
"missav.ai/"
] }],
name: "最近更新",
maintainers: ["TonyRL"],
handler,
url: "missav.ws/dm397/new"
};
async function handler() {
const baseUrl = "https://missav.ws";
const url = `${baseUrl}/${urlPath}`;
const browser = await puppeteer_default();
const page = await browser.newPage();
await page.setRequestInterception(true);
page.on("request", (request) => {
request.resourceType() === "document" || request.resourceType() === "script" || request.resourceType() === "xhr" ? request.continue() : request.abort();
});
await page.goto(url, { waitUntil: "domcontentloaded" });
const response = await page.evaluate(() => document.documentElement.innerHTML);
await browser.close();
const $ = cheerio.load(response);
const items = $(".grid .group").toArray().map((item) => {
const $item = $(item);
const title = $item.find(".text-secondary");
const poster = new URL($item.find("img").data("src"));
poster.searchParams.set("class", "normal");
const video = $item.find("video").data("src");
return {
title: title.text().trim(),
link: title.attr("href"),
description: art(path.join(__dirname, "templates/preview-33dc747c.art"), {
poster: poster.href,
video,
type: video.split(".").pop()
})
};
});
return {
title: $("head title").text(),
description: $("head meta[name=\"description\"]").attr("content"),
link: baseUrl,
item: items
};
}
//#endregion
export { route };