UNPKG

rsshub

Version:
41 lines (40 loc) 1.25 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 { load } from "cheerio"; //#region lib/routes/cpu/jwc.ts const route = { path: "/jwc", categories: ["university"], example: "/cpu/jwc", name: "教务处", maintainers: ["kba977"], handler }; async function handler() { const baseUrl = "https://jwc.cpu.edu.cn"; const url = `${baseUrl}/851/list.htm`; const response = await rofetch(url); const $ = load(response); const list = $("div#wp_news_w6 ul.news_list li").slice(0, 10).toArray().map((item) => { const $item = $(item); const $link = $item.find("a"); return { title: $link.attr("title"), link: new URL($link.attr("href"), baseUrl).href, pubDate: parseDate($item.find("span.news_meta").text()) }; }); return { title: "中国药科大学 - 教务处 | 最新通知", link: url, item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const detail = await rofetch(item.link); item.description = load(detail)("div.article").html(); return item; }))), description: "中国药科大学 | 教务处" }; } //#endregion export { route };