UNPKG

rsshub

Version:
47 lines (46 loc) 1.42 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/hnust/graduate.ts const map = { sszs: "sszs/", bszs: "bszs/" }; const route = { path: "/graduate/:type?", categories: ["university"], example: "/hnust/graduate/sszs", parameters: { type: "默认为 `sszs`" }, name: "研究生院招生工作", maintainers: ["Pretty9"], description: `| 硕士招生 | 博士招生 | | -------- | -------- | | sszs | bszs |`, handler }; async function handler(ctx) { const { type = "sszs" } = ctx.req.param(); const base = "https://graduate.hnust.edu.cn/zsgz/" + (Object.hasOwn(map, type) ? map[type] : map.sszs); const link = `${base}index.htm`; const $ = load(await rofetch(link)); return { title: "湖南科技大学研究生院招生工作通知", link, description: "湖南科技大学研究生院招生工作通知", image: "https://i.loli.net/2020/03/24/EAoPzbTsBxeOdjH.jpg", item: $(".list .item ul li").toArray().map((item) => { const $item = $(item); const date = $item.find("span").text(); const title = $item.find("a").text(); return { title, description: title, pubDate: timezone(parseDate(date), 8), link: base + $item.find("a").attr("href") }; }) }; } //#endregion export { route };