rsshub
Version:
Make RSS Great Again!
42 lines (41 loc) • 1.33 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.mjs";
import { t as timezone } from "./timezone-DE--ze1V.mjs";
import { load } from "cheerio";
//#region lib/routes/scu/xg/notice.ts
const route = {
path: "/xg/notice",
categories: ["university"],
example: "/scu/xg/notice",
radar: [{ source: ["xgb.scu.edu.cn/index/tzgg.htm"] }],
name: "学工部通知公告",
maintainers: ["stevelee477"],
handler,
url: "xgb.scu.edu.cn/index/tzgg.htm"
};
async function handler() {
const link = `https://xgb.scu.edu.cn/index/tzgg.htm`;
const $ = load(await rofetch(link));
const list = $("li.news-list > a").toArray().map((item) => {
const $item = $(item);
return {
title: $item.find(".title").text(),
link: new URL($item.attr("href"), link).href,
pubDate: timezone(parseDate(`${$item.find(".year-month").text()}-${$item.find(".date").text()}`, "YYYY-MM-DD"), 8)
};
});
return {
title: "四川大学学工部 - 通知公告",
link,
item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
const $detail = load(await rofetch(item.link));
return {
...item,
description: $detail(".v_news_content").html()
};
})))
};
}
//#endregion
export { route };