UNPKG

rsshub

Version:
43 lines (41 loc) 1.37 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import "./got-KxxWdaxq.mjs"; import { i as rootUrl, n as getInfo, r as processItems, t as apiRootUrl } from "./util-CXmsbZDN.mjs"; //#region lib/routes/cyzone/author.ts const route = { path: "/author/:id", categories: ["new-media"], example: "/cyzone/author/1225562", parameters: { id: "作者 id,可在对应作者页 URL 中找到" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["cyzone.cn/author/:id", "cyzone.cn/"] }], name: "作者", maintainers: ["nczitzk"], handler }; async function handler(ctx) { const id = ctx.req.param("id"); const limit = ctx.req.query("limit") ? Number.parseInt(ctx.req.query("limit"), 10) : 5; const apiUrl = new URL("v2/author/author/detail", apiRootUrl).href; const currentUrl = new URL(`author/${id}`, rootUrl).href; return { item: await processItems(apiUrl, limit, cache_default.tryGet, { author_id: id }), ...await getInfo(currentUrl, cache_default.tryGet) }; } //#endregion export { route };