UNPKG

rsshub

Version:
52 lines (50 loc) 1.62 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { n as SUB_URL, r as article_default, t as SUB_NAME_PREFIX } from "./const-CI4Az-fR.mjs"; import { load } from "cheerio"; //#region lib/routes/everia/category.ts const route = { path: "/category/:category", categories: ["picture"], example: "/everia/category/cosplay", parameters: { category: "Category of the image stream" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false, nsfw: true }, radar: [{ source: ["everia.club/category/:category"], target: "/category/:category" }], name: "Images with category", maintainers: ["KTachibanaM", "AiraNadih"], handler }; async function handler(ctx) { const limit = Number.parseInt(ctx.req.query("limit")) || 20; const category = ctx.req.param("category"); const categoryUrl = `${SUB_URL}category/${category}/`; const $ = load((await got_default(categoryUrl)).body); const itemRaw = $("article.blog-entry").slice(0, limit).toArray(); return { title: `${SUB_NAME_PREFIX} - Category: ${category}`, link: categoryUrl, item: await Promise.all(itemRaw.map((e) => { const link = $(e).find("h2.entry-title a").attr("href"); return cache_default.tryGet(link, () => article_default(link)); })) }; } //#endregion export { route };