UNPKG

rsshub

Version:
43 lines (42 loc) 1.33 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/gdou/jwtz.ts const route = { path: "/jwc", categories: ["university"], example: "/gdou/jwc", radar: [{ source: ["jwc.gdou.edu.cn/jwdt/jwtz.htm"] }], name: "教务通知", maintainers: ["Xiaotouming"], handler, url: "jwc.gdou.edu.cn/jwdt/jwtz.htm" }; async function handler() { const link = "https://jwc.gdou.edu.cn/jwdt/jwtz.htm"; const response = await rofetch(link); const $ = load(response); const list = $("li[id^=\"line_u8_\"] a").slice(0, 10).toArray().map((item) => { const $item = $(item); return { title: $item.find("em").text(), link: new URL($item.attr("href"), link).href, pubDate: timezone(parseDate($item.find("span").text(), "YYYY-MM-DD"), 8), author: "教务部" }; }); const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const response = await rofetch(item.link); item.description = load(response)(".v_news_content").html(); return item; }))); return { title: $("head title").text(), link, item: items }; } //#endregion export { route };