rsshub
Version:
Make RSS Great Again!
46 lines (45 loc) • 1.33 kB
JavaScript
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { t as got_default } from "./got-c1b4SNWl.mjs";
import { t as timezone } from "./timezone-DE--ze1V.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 $ = load((await got_default({
method: "get",
url: apiUrl
})).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");
return {
title,
link: new URL(href, baseUrl).href,
pubDate: timezone(parseDate($item.find(".date-display-single").attr("content")), 8)
};
});
return {
title: `${museumName} - 湘博动态`,
link: apiUrl,
language: "zh-CN",
item: items
};
}
};
//#endregion
export { route };