UNPKG

rsshub

Version:
53 lines (51 loc) 1.46 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/latest.ts const url = SUB_URL; const route = { path: "/", categories: ["picture"], example: "/8kcos/", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false, nsfw: true }, radar: [{ source: ["8kcosplay.com/"], target: "" }], name: "最新", maintainers: ["KotoriK"], handler, url: "8kcosplay.com/" }; async function handler(ctx) { const limit = Number.parseInt(ctx.req.query("limit")); const response = await got_default(url); const itemRaw = load(response.body)("ul.post-loop li.item").toArray(); return { title: `${SUB_NAME_PREFIX}-最新`, link: url, item: response.body && 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 };