UNPKG

rsshub

Version:
44 lines (43 loc) 1.32 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as parseDate } from "./parse-date-CjhZE69i.mjs"; import { t as timezone } from "./timezone-DE--ze1V.mjs"; import { load } from "cheerio"; //#region lib/routes/cqust/jw.ts const route = { path: "/jw/:type?", categories: ["university"], example: "/cqust/jw/notify", parameters: { type: "可选,默认为 `notify`" }, name: "教务处公告", maintainers: ["binarization"], description: `| 通知公告 | 教务快讯 | | -------- | -------- | | notify | news |`, handler }; const host = "http://jw.cqust.edu.cn"; const map = { notify: "/tzgg/tz.htm", news: "/xwdt/xxyw.htm" }; async function handler(ctx) { const { type = "notify" } = ctx.req.param(); const link = host + map[type]; const $ = load(await rofetch(link)); return { title: "重科教务处", link, description: $("meta[name=\"description\"]").attr("content") || "重科教务处", item: $("li[id^=\"lineu\"]").toArray().slice(0, 10).map((item) => { const $item = $(item); return { title: $item.find("a").text(), description: $item.find("p").text() + " [...]", pubDate: timezone(parseDate($item.find(".shijian").text().replace("》", "")), 8), link: new URL($item.find("a").attr("href"), host).href }; }) }; } //#endregion export { route };