UNPKG

rsshub

Version:
42 lines (40 loc) 1.51 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 "./render-BQo6B4tL.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { c as fetchData, d as rootUrl, r as apiMemberRootUrl, u as processItems } from "./util-DaV7o5tf.mjs"; //#region lib/routes/huxiu/member.ts const route = { path: ["/author/:id/:type?", "/member/:id/:type?"], name: "用户", example: "/huxiu/member/2313050", categories: ["new-media"], parameters: { id: "用户 id,可在对应用户页 URL 中找到" }, maintainers: ["nczitzk"], handler, description: `| TA 的文章 | TA 的 24 小时 | | --------- | ------------- | | article | moment |` }; async function handler(ctx) { const { id, type = "article" } = ctx.req.param(); const limit = ctx.req.query("limit") ? Number.parseInt(ctx.req.query("limit"), 10) : 10; const apiUrl = new URL(`web/${type}/${type}List`, apiMemberRootUrl).href; const currentUrl = new URL(`member/${id}${type === "article" ? "" : `/${type}`}.html`, rootUrl).href; const { data: response } = await got_default.post(apiUrl, { form: { platform: "www", uid: id } }); return { item: await processItems(response.data.datalist, limit, cache_default.tryGet), ...await fetchData(currentUrl) }; } //#endregion export { route };