UNPKG

rsshub

Version:
53 lines (51 loc) 1.64 kB
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 "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { n as fetchUserDate, t as baseUrl } from "./utils-CEzs3KSX.mjs"; //#region lib/routes/zhiy/letter.ts const route = { path: "/letters/:author", categories: ["new-media"], example: "/zhiy/letters/messy", parameters: { author: "作者 ID,可在URL中找到" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["zhiy.cc/:author"] }], name: "Newsletter", maintainers: ["TonyRL"], handler }; async function handler(ctx) { const author = ctx.req.param("author"); const { author_id: authorId, author_name: authorName, author_signature: authorSignature, author_avatar_url: authorAvatarUrl } = await fetchUserDate(author); const { data: { result: letters } } = await got_default(`${baseUrl}/api/app/users/${authorId}/letters`, { searchParams: { page: 1, limit: ctx.req.query("limit") ? Number.parseInt(ctx.req.query("limit")) : 100 } }); const items = letters.map((item) => ({ title: item.title, description: item.shortcut, pubDate: parseDate(item.send_time, "X"), link: `${baseUrl}/letter/${item.id}` })); return { title: authorName, link: `${baseUrl}/${author}`, description: authorSignature, image: authorAvatarUrl, item: items }; } //#endregion export { route };