UNPKG

rsshub

Version:
43 lines (42 loc) 1.36 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/cug/graduate.ts const route = { path: "/graduate", categories: ["university"], example: "/cug/graduate", radar: [{ source: ["graduate.cug.edu.cn/tzgg.htm"] }], name: "研究生院通知公告", maintainers: ["sanmmm"], handler, url: "graduate.cug.edu.cn/tzgg.htm" }; async function handler() { const baseUrl = "https://graduate.cug.edu.cn"; const link = `${baseUrl}/tzgg.htm`; const res = await rofetch(link); const $ = load(res); const list = $(".btlist ul li").toArray().map((item) => { const $item = $(item); const a = $item.find("a"); return { title: a.attr("title") || a.text(), link: new URL(a.attr("href"), baseUrl).href, pubDate: timezone(parseDate($item.find(".time").text(), "YYYY-MM-DD"), 8) }; }); return { title: "中国地质大学(武汉)研究生院 - 通知公告", link, item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const res = await rofetch(item.link); item.description = load(res)(".v_news_content").html(); return item; }))) }; } //#endregion export { route };