UNPKG

rsshub

Version:
50 lines (48 loc) 1.51 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/tag.ts const route = { path: "/tag/:tag", categories: ["picture"], example: "/8kcos/tag/cosplay", parameters: { tag: "标签名" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false, nsfw: true }, radar: [{ source: ["8kcosplay.com/tag/:tag"] }], name: "标签", maintainers: ["KotoriK"], handler, url: "8kcosplay.com/" }; async function handler(ctx) { const limit = Number.parseInt(ctx.req.query("limit")); const url = `${SUB_URL}tag/${ctx.req.param("tag")}/`; 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 };