UNPKG

rsshub

Version:
50 lines (49 loc) 1.4 kB
import { t as got_default } from "./got-BTowW50G.mjs"; import { load } from "cheerio"; //#region lib/routes/zzu/dzb.ts const route = { path: "/dzb/:type", categories: ["university"], example: "/zzu/dzb/xwzx", parameters: { type: "分类名" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["www5.zzu.edu.cn/dzb/"] }], name: "郑大党政办", maintainers: ["amandus1990"], handler, description: `| 新闻资讯 | 通知公告 | | -------- | -------- | | xwzx | tzgg |` }; async function handler(ctx) { const type = ctx.req.param("type"); const typeDict = { xwzx: ["新闻资讯", "https://www5.zzu.edu.cn/dzb/index/xwzx.htm"], tzgg: ["通知公告", "https://www5.zzu.edu.cn/dzb/index/tzgg.htm"] }; const $ = load((await got_default(typeDict[type][1])).data); const list = $(".new_list3 dd").toArray().slice(0, 20).map((element) => { const $element = $(element); const $link = $element.find("a"); const link = new URL($link.attr("href"), typeDict[type][1]).href; return { title: $link.attr("title") || $link.text().trim(), link, pubDate: $element.find("span.fr.gray").text() || null }; }); return { title: `郑大党政办-${typeDict[type][0]}`, link: typeDict[type][1], item: list }; } //#endregion export { route };