rsshub
Version:
Make RSS Great Again!
42 lines (41 loc) • 1.36 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
//#region lib/routes/njfu/jwc.ts
const baseUrl = "https://jwc.njfu.edu.cn/sy/";
const map = {
xjfw: "校级发文",
tzgg: "通知公告",
sjfw: "上级发文",
xzzq: "下载专区"
};
const route = {
path: "/jwc/:category?",
categories: ["university"],
example: "/njfu/jwc/tzgg",
parameters: { category: "省略则默认为 tzgg" },
name: "教务处",
maintainers: ["kiusiudeng"],
description: `| 校级发文 | 通知公告 | 上级发文 | 下载专区 |
| -------- | -------- | -------- | -------- |
| xjfw | tzgg | sjfw | xzzq |`,
handler
};
async function handler(ctx) {
const { category = "tzgg" } = ctx.req.param();
const link = category === "xzzq" ? "https://jwc.njfu.edu.cn/xzzq/" : `${baseUrl}${category}/`;
const response = await rofetch(link);
const infolist = JSON.parse(response.match(/var dataList=(\[.*\]);\s*var pagesData/)[1])[0].infolist;
return {
title: `南京林业大学教务处-${map[category]}`,
link,
description: `南京林业大学教务处-${map[category]}`,
item: infolist.map((info) => ({
title: info.title,
description: info.summary || info.title,
pubDate: parseDate(info.releasetime),
link: new URL(info.url, link).href
}))
};
}
//#endregion
export { route };