rsshub
Version:
Make RSS Great Again!
49 lines (47 loc) • 1.64 kB
JavaScript
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, r as apiMemberRootUrl, s as fetchData, u as rootUrl } from "./util-B64gnjsQ.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 中找到" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: true,
supportBT: false,
supportPodcast: true,
supportScihub: false
},
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 };