UNPKG

rsshub

Version:
43 lines (41 loc) 1.32 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import "./parse-date-r5WDWHno.mjs"; import "./is-worker-DESPicPc.mjs"; import { t as cache_default } from "./cache-SV6W5EPy.mjs"; import "./helpers-Bo4JQYdN.mjs"; import { t as got_default } from "./got-CO-ndVl2.mjs"; import { n as SUB_URL, r as article_default, t as SUB_NAME_PREFIX } from "./const-H0Cp-V7f.mjs"; import { load } from "cheerio"; //#region lib/routes/8kcos/cat.ts const route = { path: "/cat/:cat{.+}?", radar: [{ source: ["8kcosplay.com/"], target: "" }], name: "Unknown", maintainers: [], handler, url: "8kcosplay.com/", features: { nsfw: true } }; async function handler(ctx) { const limit = Number.parseInt(ctx.req.query("limit")); const { cat = "8kasianidol" } = ctx.req.param(); const url = `${SUB_URL}category/${cat}/`; const $ = load((await got_default(url)).body); const itemRaw = $("li.item").toArray(); return { title: `${SUB_NAME_PREFIX}-${$("span[property=name]:not(.hide)").text()}`, link: url, item: await Promise.all((limit ? itemRaw.slice(0, limit) : itemRaw).map((e) => { const { href } = load(e)("h2 > a")[0].attribs; return cache_default.tryGet(href, () => article_default(href)); })) }; } //#endregion export { route };