rsshub
Version:
Make RSS Great Again!
43 lines (42 loc) • 1.34 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/jwc/notice.ts
const route = {
path: "/jwc/notice",
categories: ["university"],
example: "/scu/jwc/notice",
radar: [{ source: ["jwc.scu.edu.cn/tzgg.htm"] }],
name: "教务处通知公告",
maintainers: ["KXXH"],
handler
};
async function handler() {
const baseUrl = "https://jwc.scu.edu.cn";
const link = `${baseUrl}/tzgg.htm`;
const $ = load(await rofetch(link));
const list = $(".tz-list ul li a").toArray().map((item) => {
const $item = $(item);
return {
title: $item.find(".text p").text(),
link: new URL($item.attr("href"), baseUrl).href,
pubDate: timezone(parseDate(`${$item.find(".date span").text()}/${$item.find(".date p").text()}`, "YYYY/MM/DD"), 8)
};
});
return {
title: "四川大学教务处 - 通知公告",
link,
item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
const $ = load(await rofetch(item.link));
return {
...item,
title: $(".detail-tit h2").text(),
description: $(".v_news_content").html()
};
})))
};
}
//#endregion
export { route };