UNPKG

rsshub

Version:
42 lines (41 loc) 1.27 kB
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs"; import { t as parseDate } from "./parse-date-3kcy2Eau.mjs"; import { t as cache_default } from "./cache-C1Y-9qDV.mjs"; import { t as timezone } from "./timezone-UiMFOuvL.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 response = await rofetch(currentUrl); const $ = load(response); 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 res = await rofetch(item.link); const content = load(res); return { ...item, pubDate: timezone(parseDate(content("p.data").last().text()), 8), description: content("div.BSHARE_POP").html() }; }))) }; } //#endregion export { route };