UNPKG

rsshub

Version:
30 lines (29 loc) 968 B
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as cache_default } from "./cache-CiDoUSLo.mjs"; import { t as fetchThreads } from "./utils-CtwvwvJe.mjs"; //#region lib/routes/liyuans/forum.ts const route = { path: "/threads/forum/:forum_id", categories: ["bbs"], example: "/liyuans/threads/forum/1", parameters: { forum_id: "板块 ID, 支持多个, 使用英文逗号分隔" }, name: "主题帖(板块)", maintainers: ["WooMai"], handler }; async function handler(ctx) { const { forum_id: forumId } = ctx.req.param(); const feed = await fetchThreads("forum", forumId); if (!Number.isNaN(Number(forumId))) { const forumUrl = `https://api.forums.liyuans.com/forum/${forumId}`; const forum = await cache_default.tryGet(forumUrl, async () => { const { data } = await rofetch(forumUrl); return data; }); feed.title = `${forum.name} - 梨园`; feed.description = forum.descr; } return feed; } //#endregion export { route };