UNPKG

rsshub

Version:
46 lines (44 loc) 1.21 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import "./helpers-Bo4JQYdN.mjs"; import { t as got_default } from "./got-CO-ndVl2.mjs"; import { t as rss_parser_default } from "./rss-parser-Cnh4NKwh.mjs"; import { t as getConfig } from "./utils-C7f2YUyQ.mjs"; //#region lib/routes/discourse/posts.ts const route = { path: "/:configId/posts", categories: ["bbs"], example: "/discourse/0/posts", parameters: { configId: "Environment variable configuration id, see above" }, features: { requireConfig: [{ name: "DISCOURSE_CONFIG_*", description: "" }], requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "Latest posts", maintainers: ["dzx-dzx"], handler }; async function handler(ctx) { const { link, key } = getConfig(ctx); const feed = await rss_parser_default.parseString((await got_default(`${link}/posts.rss`, { headers: { "User-Api-Key": key } })).data); feed.items = feed.items.map((e) => ({ description: e.content, author: e.creator, ...e })); return { item: feed.items, ...feed }; } //#endregion export { route };