rsshub
Version:
Make RSS Great Again!
59 lines (57 loc) • 2.02 kB
JavaScript
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 { t as cache_default } from "./cache-Bo__VnGm.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import { load } from "cheerio";
//#region lib/routes/nuist/jwc.ts
const baseTitle = "南京信息工程大学-教务处";
const baseUrl = "https://jwc.nuist.edu.cn";
const route = {
path: "/jwc/:category?",
categories: ["university"],
example: "/nuist/jwc/jxyw",
parameters: { category: "默认为教学要闻" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
name: "教务处",
maintainers: ["gylidian"],
handler,
description: `| 教学要闻 | 学院教学 | 教务管理 | 教学研究 | 教务管理 | 教材建设 | 考试中心 |
| -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| jxyw | xyjx | jwgl | jxyj | sjjx | jcjs | kszx |`
};
async function handler(ctx) {
const { category = "jxyw" } = ctx.req.param();
const link = `${baseUrl}/${category === "jxyw" || category === "xyjx" ? "index" : "xxtz"}/${category}.htm`;
const $ = load((await got_default(link)).data);
const list = $(".main_list ul li").toArray().map((item) => {
item = $(item);
return {
title: item.find("a").contents().first().text(),
link: new URL(item.find("a").attr("href"), baseUrl).href,
pubDate: parseDate(item.find(".date").text())
};
});
const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
item.description = load((await got_default(item.link)).data)("#vsb_content").html();
return item;
})));
return {
title: baseTitle + ":" + $(".dqwz").find("a").eq(1).text(),
link,
item: items
};
}
//#endregion
export { route };