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/topic.ts const route = { path: "/threads/topic/:topic_id", categories: ["bbs"], example: "/liyuans/threads/topic/1", parameters: { topic_id: "专题 ID, 支持多个, 使用英文逗号分隔" }, name: "主题帖(专题)", maintainers: ["WooMai"], handler }; async function handler(ctx) { const { topic_id: topicId } = ctx.req.param(); const feed = await fetchThreads("topic", topicId); if (!Number.isNaN(Number(topicId))) { const topicUrl = `https://api.forums.liyuans.com/topic/${topicId}`; const topic = await cache_default.tryGet(topicUrl, async () => { const { data } = await rofetch(topicUrl); return data; }); feed.title = `${topic.name} - 梨园`; feed.description = topic.descr; } return feed; } //#endregion export { route };