UNPKG

rsshub

Version:
48 lines (46 loc) 1.47 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 { l as processItems, n as apiClubRootUrl, o as fetchClubData } from "./util-B64gnjsQ.mjs"; //#region lib/routes/huxiu/club.ts const route = { path: "/club/:id", name: "源流", categories: ["new-media"], example: "/huxiu/club/1161", parameters: { id: "源流 id,可在对应源流页 URL 中找到" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: true, supportBT: false, supportPodcast: true, supportScihub: false }, maintainers: ["nczitzk", "TimoYoung"], handler, description: "更多源流请参见 [源流](https://www.huxiu.com/club)" }; async function handler(ctx) { const id = ctx.req.param("id"); const limit = ctx.req.query("limit") ? Number.parseInt(ctx.req.query("limit"), 10) : 20; const apiUrl = new URL("v1/club/briefList", apiClubRootUrl).href; const data = await fetchClubData(id); const { data: response } = await got_default.post(apiUrl, { form: { platform: "www", club_id: id, pagesize: limit } }); return { item: await processItems(response.data.datalist, limit, cache_default.tryGet), ...data }; } //#endregion export { route };