UNPKG

rsshub

Version:
61 lines (59 loc) 1.72 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 { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import { load } from "cheerio"; //#region lib/routes/swjtu/gsee/yjs.ts const rootURL = "https://gsee.swjtu.edu.cn"; const urlAddr = `${rootURL}/xwzx/tzgg.htm`; const getItem = (item) => { const newsInfo = item.find("dt"); const newsDate = item.find("dd").text().match(/\d{4}(-|\/|.)\d{1,2}\1\d{1,2}/)[0]; const infoTitle = newsInfo.text(); const link = rootURL + newsInfo.find("a").last().attr("href").slice(2); return cache_default.tryGet(link, async () => { const infoText = load(await ofetch_default(link))(".article").html(); return { title: infoTitle, pubDate: parseDate(newsDate), link, description: infoText }; }); }; const route = { path: "/gsee/yjs", categories: ["university"], example: "/swjtu/gsee/yjs", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: true, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["gsee.swjtu.edu.cn/"] }], name: "地球科学与工程学院", maintainers: ["E1nzbern"], handler, description: `研究生教育通知公告` }; async function handler() { const $ = load(await ofetch_default(urlAddr)); const list = $("dl"); return { title: "西南交大地学学院-研究生通知", link: urlAddr, item: await Promise.all(list.toArray().map((i) => { return getItem($(i)); })), allowEmpty: true }; } //#endregion export { route };