UNPKG

rsshub

Version:
45 lines (44 loc) 1.54 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/dlmu/grs/zsgz.ts const route = { path: "/grs/zsgz/:type", categories: ["university"], example: "/dlmu/grs/zsgz/ssyjs", parameters: { type: "招生类别" }, name: "研究生院 - 招生工作", maintainers: ["nczitzk"], handler, description: `| 博士研究生 | 硕士研究生 | 同等学力攻读硕士学位 | 港澳台地区招生 | | :--------: | :--------: | :------------------: | :------------: | | bsyjs | ssyjs | tdxlgdssxw | gatdqzs |` }; async function handler(ctx) { const { type } = ctx.req.param(); const link = `http://grs.dlmu.edu.cn/zsgz/${type}.htm`; const response = await rofetch(link); const $ = load(response); const list = $("div.main_conRCb ul li").toArray().map((item) => { const $item = $(item); const a = $item.find("a"); return { title: a.text(), link: new URL(a.attr("href"), link).href, pubDate: timezone(parseDate($item.find("span").text()), 8) }; }); return { title: $("title").text(), link, item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const detailResponse = await rofetch(item.link); item.description = load(detailResponse)("div.main_conDiv").html(); return item; }))) }; } //#endregion export { route };