UNPKG

rsshub

Version:
71 lines (69 loc) 2.15 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import "./helpers-DxBp0Pty.mjs"; import "./proxy-Db7uGcYb.mjs"; import "./got-KxxWdaxq.mjs"; import { t as timezone } from "./timezone-D8cuwzTY.mjs"; import { t as invalid_parameter_default } from "./invalid-parameter-rr4AgGpp.mjs"; import "./puppeteer-DGmvuGvT.mjs"; import { t as getContent } from "./utils-BFQW6UlK.mjs"; import { load } from "cheerio"; //#region lib/routes/njust/dgxg.ts const map = new Map([ ["gstz", { title: "南京理工大学电光学院研学网 -- 公示通知", id: "/6509" }], ["xswh", { title: "南京理工大学电光学院研学网 -- 学术文化", id: "/6511" }], ["jyzd", { title: "南京理工大学电光学院研学网 -- 就业指导", id: "/6510" }] ]); const host = "https://dgxg.njust.edu.cn"; const route = { path: "/dgxg/:type?", categories: ["university"], example: "/njust/dgxg/gstz", parameters: { type: "分类名,见下表,默认为公示通知" }, features: { requireConfig: false, requirePuppeteer: true, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "电光学院研学网", maintainers: ["jasongzy"], handler, description: `| 公示通知 | 学术文化 | 就业指导 | | -------- | -------- | -------- | | gstz | xswh | jyzd |` }; async function handler(ctx) { const type = ctx.req.param("type") ?? "gstz"; const info = map.get(type); if (!info) throw new invalid_parameter_default("invalid type"); const siteUrl = host + info.id + "/list.htm"; const $ = load(await getContent(siteUrl, true)); const list = $("ul.wp_article_list").find("li"); return { title: info.title, link: siteUrl, item: list.toArray().map((item) => ({ title: $(item).find("a").attr("title").trim(), pubDate: timezone(parseDate($(item).find("span.Article_PublishDate").text(), "YYYY-MM-DD"), 8), link: $(item).find("a").attr("href") })) }; } //#endregion export { route };