UNPKG

rsshub

Version:
55 lines (53 loc) 1.76 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import { load } from "cheerio"; //#region lib/routes/bangumi.tv/group/topic.ts const baseUrl = "https://bgm.tv"; const route = { path: "/group/:id", categories: ["anime"], example: "/bangumi.tv/group/boring", parameters: { id: "小组 id, 在小组页面地址栏查看" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["bgm.tv/group/:id"] }], name: "小组话题", maintainers: ["SettingDust"], handler }; async function handler(ctx) { const link = `${baseUrl}/group/${ctx.req.param("id")}/forum`; const $ = load(await ofetch_default(link)); return { title: "Bangumi - " + $(".SecondaryNavTitle").text(), link, item: await Promise.all($(".topic_list .topic").toArray().map((elem) => { const link$1 = new URL($(".subject a", elem).attr("href"), baseUrl).href; return cache_default.tryGet(link$1, async () => { const $$1 = load(await ofetch_default(link$1)); const fullText = $$1(".postTopic .topic_content").html(); const summary = "Reply: " + $$1(".posts", elem).text(); return { link: link$1, title: $$1(".subject a", elem).attr("title"), pubDate: parseDate($$1(".lastpost .time", elem).text()), description: fullText ? summary + "<br><br>" + fullText : summary, author: $$1(".author a", elem).text() }; }); })) }; } //#endregion export { route };