rsshub
Version:
Make RSS Great Again!
59 lines (57 loc) • 1.79 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
import "./cache-Bo__VnGm.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import { t as auth_default } from "./auth-Cby6FaL3.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 };