UNPKG

rsshub

Version:
39 lines (38 loc) 1.19 kB
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 { 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 $ = load(await rofetch(url)); 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 () => { item.description = load(await rofetch(item.link))("div.article").html(); return item; }))), description: "中国药科大学 | 教务处" }; } //#endregion export { route };