UNPKG

rsshub

Version:
59 lines (57 loc) 1.79 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import { t as parseDate } from "./parse-date-r5WDWHno.mjs"; import "./is-worker-DESPicPc.mjs"; import "./cache-SV6W5EPy.mjs"; import "./helpers-Bo4JQYdN.mjs"; import { t as got_default } from "./got-CO-ndVl2.mjs"; import { t as auth_default } from "./auth-DLI2heDv.mjs"; //#region lib/routes/zhihu/xhu/answers.ts const route = { path: "/xhu/people/answers/:hexId", categories: ["social-media"], example: "/zhihu/xhu/people/answers/246e6cf44e94cefbf4b959cb5042bc91", parameters: { hexId: "用户的 16 进制 id,获取方式同 [xhu - 用户动态](#zhi-hu-xhu-yong-hu-dong-tai)" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["www.zhihu.com/people/:id/answers"], target: "/people/answers/:id" }], name: "xhu - 用户回答", maintainers: ["JimenezLi"], handler }; async function handler(ctx) { const xhuCookie = await auth_default.getCookie(); const hexId = ctx.req.param("hexId"); const link = `https://www.zhihu.com/people/${hexId}/answers`; const data = (await got_default({ method: "get", url: `https://api.zhihuvvv.workers.dev/people/${hexId}/answers?limit=20&offset=0`, headers: { Referer: "https://api.zhihuvvv.workers.dev", Cookie: xhuCookie } })).data.data; return { title: `${data[0].author.name}的知乎回答`, link, item: data.map((item) => ({ title: item.question.title, description: item.excerpt, pubDate: parseDate(item.created_time * 1e3), link: `https://www.zhihu.com/question/${item.question.id}/answer/${item.id}` })) }; } //#endregion export { route };