UNPKG

rsshub

Version:
81 lines (79 loc) 2.39 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs"; import { load } from "cheerio"; //#region lib/routes/ncku/phys.ts const currentURL = (catagory) => `https://phys.ncku.edu.tw/news/${catagory === "_all" ? "" : catagory}`; const catagories = { "24": "物理系", scholarship: "獎助學金", admission: "招生與錄取報到", "course-announcement": "助教公告", "bachelor-announcement": "大學部", "master-announcement": "研究所", graduation: "畢業離校", "student-guide": "學生手冊與新生入學", honor: "榮譽榜", career: "求才公告", others: "其他", _all: "所有訊息" }; const route = { "zh-TW": { name: "國立成功大學物理系公告" }, name: "Phys News", description: `| 分類 | catagory | | ---- | ---- | | 物理系 | 24 | | 獎助學金 | scholarship | | 招生與錄取報到 | admission | | 助教公告 | course-announcement | | 大學部 | bachelor-announcement | | 研究所 | master-announcement | | 畢業離校 | graduation | | 學生手冊與新生入學 | student-guide | | 榮譽榜 | honor | | 求才公告 | career | | 其他 | others | | 所有訊息 | _all | `, path: "/phys/:catagory?", parameters: { catagory: "catagory, default is _all" }, categories: ["university"], example: "/ncku/phys/_all", features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["phys.ncku.edu.tw/news/"], target: "/phys/_all" }, { source: ["phys.ncku.edu.tw/news/:catagory/"], target: "/phys/:catagory" }], maintainers: ["simbafs"], handler: async (ctx) => { let catagory = ctx.req.param("catagory") ?? "_all"; if (catagories[catagory] === void 0) catagory = "_all"; const $ = await ofetch_default(currentURL(catagory), { parseResponse: load }); const item = $(".newsList .Txt").toArray().map((e) => ({ title: $("a", e).text(), pubDate: new Date($(".newsDate", e).text().match(/\d{4}(?: \/ \d{2}){2}/)?.[0] || ""), link: $("a", e).attr("href"), catagory: $(".newIcon", e).text() })); return { title: `成大物理系公告 - ${catagories[catagory]}`, link: currentURL(catagory), item }; } }; //#endregion export { route };