rsshub
Version:
Make RSS Great Again!
44 lines (43 loc) • 1.22 kB
JavaScript
import { t as parseDate } from "./parse-date-Cr0wQjV_.mjs";
import { t as got_default } from "./got-BTowW50G.mjs";
import { t as namespace } from "./namespace-y0YEP6Cr.mjs";
import { load } from "cheerio";
//#region lib/routes/sxhm/announcement.ts
const route = {
path: "/announcement",
categories: ["travel"],
example: "/sxhm/announcement",
parameters: {},
name: "Announcements",
maintainers: ["magazian"],
radar: [{
source: ["www.sxhm.com/info/announcement.html"],
target: "/announcement"
}],
handler: async () => {
const baseUrl = "https://www.sxhm.com";
const apiUrl = `${baseUrl}/info/announcement.html`;
const museumName = namespace.zh?.name || namespace.name;
const $ = load((await got_default({
method: "get",
url: apiUrl
})).data);
const items = $(".listwrap .list .li").toArray().map((el) => {
const $item = $(el);
const $a = $item.find(".ltit a");
return {
title: $item.find(".ltit .t").text(),
link: new URL($a.attr("href"), baseUrl).href,
pubDate: parseDate($item.find(".lcont .date").text())
};
});
return {
title: `${museumName} - 最新公告`,
link: apiUrl,
language: "zh-CN",
item: items
};
}
};
//#endregion
export { route };