UNPKG

rsshub

Version:
60 lines (58 loc) 1.71 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import "./helpers-Bo4JQYdN.mjs"; import { t as got_default } from "./got-CO-ndVl2.mjs"; import { load } from "cheerio"; //#region lib/routes/zzu/ss.ts const route = { path: "/ss/:type", categories: ["university"], example: "/zzu/ss/xwzx", parameters: { type: "分类名" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["www5.zzu.edu.cn/ss/"] }], 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/ss/index/skxw.htm"], tzgg: ["通知公告", "https://www5.zzu.edu.cn/ss/index/tzgg.htm"] }; const $ = load((await got_default(typeDict[type][1])).data); const list = $(".list_notice > a").toArray().slice(0, 10).map((element) => { const $element = $(element); const link = new URL($element.attr("href"), typeDict[type][1]).href; const title = $element.find("h3").text().trim(); const pubDateText = $element.find("time").text().trim(); let pubDate = null; if (pubDateText) if (type === "xwzx") pubDate = `${(/* @__PURE__ */ new Date()).getFullYear()}-${pubDateText}`; else pubDate = pubDateText; return { title, link, pubDate }; }); return { title: `郑大社科院-${typeDict[type][0]}`, link: typeDict[type][1], item: list }; } //#endregion export { route };