UNPKG

rsshub

Version:
61 lines (59 loc) 1.85 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 { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { t as timezone } from "./timezone-D8cuwzTY.mjs"; import { load } from "cheerio"; //#region lib/routes/zhibo8/forum.ts const route = { path: "/forum/:id", categories: ["bbs"], example: "/zhibo8/forum/8", parameters: { id: "子论坛 id,可在子论坛 URL 找到" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "子论坛", maintainers: ["LogicJake"], handler }; async function handler(ctx) { const link = `https://bbs.zhibo8.cc/forum/list/?fid=${ctx.req.param("id")}`; const $ = load((await got_default(link)).data); const title = $("div.intro > h2").text(); const list = $("table.topic-list > tbody:nth-child(3) > tr"); const out = await Promise.all(list.toArray().map((item) => { item = $(item); const a = item.find("td:nth-child(1) > a:nth-child(2)"); const link$1 = "https://bbs.zhibo8.cc" + a.attr("href"); return cache_default.tryGet(link$1, async () => { const title$1 = a.text(); const author = item.find("td:nth-child(2) cite a").text(); const date = item.find("td:nth-child(2) em").text(); return { title: title$1, description: load((await got_default(link$1)).data)(".detail_ent").html(), author, link: link$1, pubDate: timezone(parseDate(date, "YYYY-MM-DD HH:mm"), 8) }; }); })); return { title: `${title}—直播吧`, link, item: out }; } //#endregion export { route };