rsshub
Version:
Make RSS Great Again!
45 lines (44 loc) • 1.41 kB
JavaScript
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs";
import { t as parseDate } from "./parse-date-3kcy2Eau.mjs";
import { t as cache_default } from "./cache-C1Y-9qDV.mjs";
import { t as timezone } from "./timezone-UiMFOuvL.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 response = await rofetch(link);
const $ = load(response);
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 detailResponse = await rofetch(item.link);
const $ = load(detailResponse);
return {
...item,
title: $(".detail-tit h2").text(),
description: $(".v_news_content").html()
};
})))
};
}
//#endregion
export { route };