UNPKG

rsshub

Version:
49 lines (48 loc) 1.41 kB
import { t as parseDate } from "./parse-date-3kcy2Eau.mjs"; import { t as got_default } from "./got-DUpa1V3-.mjs"; import { t as timezone } from "./timezone-UiMFOuvL.mjs"; import { t as namespace } from "./namespace-BObCzy4A.mjs"; import { load } from "cheerio"; //#region lib/routes/hnmuseum/hnmnews.ts const route = { path: "/hnmnews", categories: ["travel"], example: "/hnmuseum/hnmnews", name: "HNM News", maintainers: ["magazian"], radar: [{ source: ["www.hnmuseum.com/zh-hans/xiangbo_dongtai_news"], target: "/hnmnews" }], handler: async () => { const baseUrl = "https://www.hnmuseum.com"; const apiUrl = `${baseUrl}/zh-hans/xiangbo_dongtai_news`; const museumName = namespace.zh?.name || namespace.name; const response = await got_default({ method: "get", url: apiUrl }); const $ = load(response.data); const items = $(".view-content .views-row").toArray().map((el) => { const $item = $(el); const $a = $item.find(".views-field-title-1 a"); const title = $a.text(); const href = $a.attr("href"); const link = new URL(href, baseUrl).href; const dateString = $item.find(".date-display-single").attr("content"); return { title, link, pubDate: timezone(parseDate(dateString), 8) }; }); return { title: `${museumName} - 湘博动态`, link: apiUrl, language: "zh-CN", item: items }; } }; //#endregion export { route };