UNPKG

rsshub

Version:
46 lines (45 loc) 1.4 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-BIfgRAES.mjs"; import { load } from "cheerio"; //#region lib/routes/gdmuseum/news.ts const route = { path: "/information", categories: ["travel"], example: "/gdmuseum/information", name: "Information", maintainers: ["magazian"], radar: [{ source: ["www.gdmuseum.org.cn/cn/col51/list"], target: "/information" }], handler: async () => { const baseUrl = "https://www.gdmuseum.org.cn"; const apiUrl = `${baseUrl}/cn/col51/list`; const museumName = namespace.zh?.name || namespace.name; const response = await got_default(apiUrl); const $ = load(response.data); const list = $(".ULLIST li a[href^=\"/cn/col\"]").toArray().map((el) => { const $item = $(el); const rawLink = $item.attr("href") || ""; const itemLink = new URL(rawLink, baseUrl).href; const title = $item.find("h3.h3.qui-dot").text(); const day = $item.find("time b").text(); const yearMonth = $item.find("time i").text(); return { title, link: itemLink, pubDate: timezone(parseDate(`${yearMonth}-${day}`), 8) }; }); return { title: `${museumName} - 公告`, link: apiUrl, language: "zh-CN", item: list }; } }; //#endregion export { route };