rsshub
Version:
Make RSS Great Again!
58 lines (56 loc) • 1.75 kB
JavaScript
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/posts.ts
const route = {
path: "/xhu/people/posts/:hexId",
categories: ["social-media"],
example: "/zhihu/xhu/people/posts/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
},
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}/posts`;
const data = (await got_default({
method: "get",
url: `https://api.zhihuvvv.workers.dev/people/${hexId}/articles?limit=20&offset=0`,
headers: {
Referer: "https://api.zhihuvvv.workers.dev",
Cookie: xhuCookie
}
})).data.data;
return {
title: `${data[0].author.name} 的知乎文章`,
link,
image: data[0].author.avatar_url,
description: data[0].author.headline,
item: data.map((item) => ({
title: item.title,
description: item.excerpt,
pubDate: parseDate(item.created * 1e3),
link: `https://zhuanlan.zhihu.com/p/${item.id}`,
author: item.author.name
}))
};
}
//#endregion
export { route };