rsshub
Version:
Make RSS Great Again!
60 lines (58 loc) • 1.67 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 "./helpers-DxBp0Pty.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import { t as timezone } from "./timezone-D8cuwzTY.mjs";
import { load } from "cheerio";
//#region lib/routes/nju/scit.ts
const route = {
path: "/scit/:type",
categories: ["university"],
example: "/nju/scit/tzgg",
parameters: { type: "分类名" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
name: "科学技术处",
maintainers: ["ret-1"],
handler,
description: `| 通知公告 | 科研动态 |
| -------- | -------- |
| tzgg | kydt |`
};
async function handler(ctx) {
const type = ctx.req.param("type");
const type_dict = {
tzgg: ["https://scit.nju.edu.cn/10916/list.htm", "通知公告"],
kydt: ["https://scit.nju.edu.cn/11003/list.htm", "科研动态"]
};
const data = (await got_default({
method: "get",
url: type_dict[type][0]
})).data;
const $ = load(data);
const list = $("li.list_item");
return {
title: `科学技术处-${type_dict[type][1]}`,
link: type_dict[type][0],
item: list.toArray().map((item) => {
item = $(item);
return {
title: item.find("a").attr("title"),
link: "https://scit.nju.edu.cn" + item.find("a").attr("href"),
pubDate: timezone(parseDate(item.find(".Article_PublishDate").first().text(), "YYYY-MM-DD"), 8)
};
})
};
}
//#endregion
export { route };