UNPKG

rsshub

Version:
44 lines (43 loc) 1.4 kB
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/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 response = await rofetch(link); const $ = load(response); 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 detailResponse = await rofetch(item.link); const $detail = load(detailResponse); return { ...item, description: $detail(".v_news_content").html() }; }))) }; } //#endregion export { route };