UNPKG

rsshub

Version:
40 lines (39 loc) 1.23 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as parseDate } from "./parse-date-CjhZE69i.mjs"; import { t as cache_default } from "./cache-CiDoUSLo.mjs"; import { t as timezone } from "./timezone-DE--ze1V.mjs"; import { load } from "cheerio"; //#region lib/routes/samsungmembers/latest.ts const route = { path: "/latest", categories: ["bbs"], example: "/samsungmembers/latest", name: "最新帖子", maintainers: ["nczitzk"], handler }; async function handler() { const currentUrl = "https://www.samsungmembers.cn/bbs/"; const $ = load(await rofetch(currentUrl)); const list = $("div.ImgList dl dt").slice(0, 15).toArray().map((item) => { const a = $(item).find("a"); return { title: a.text(), link: new URL(a.attr("href"), "http://www.samsungmembers.cn/").href }; }); return { title: "三星盖乐世社区 - 最新帖子", link: currentUrl, item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const content = load(await rofetch(item.link)); return { ...item, pubDate: timezone(parseDate(content("p.data").last().text()), 8), description: content("div.BSHARE_POP").html() }; }))) }; } //#endregion export { route };