rsshub
Version:
Make RSS Great Again!
47 lines (46 loc) • 1.35 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.mjs";
import { t as timezone } from "./timezone-DE--ze1V.mjs";
import { load } from "cheerio";
//#region lib/routes/njtech/jwc.ts
const link = `https://jwc.njtech.edu.cn/index/ggtz.htm`;
const route = {
path: "/jwc",
categories: ["university"],
example: "/njtech/jwc",
radar: [{ source: ["jwc.njtech.edu.cn/index/ggtz.htm"] }],
name: "教务处",
maintainers: ["TrumanGu"],
handler,
url: "jwc.njtech.edu.cn/index/ggtz.htm"
};
async function handler() {
const $ = load(await rofetch(link));
const list = $(".my-list li").toArray().map((item) => {
const $item = $(item);
const a = $item.find("a");
return {
title: a.text(),
link: new URL(a.attr("href"), link).href,
pubDate: timezone(parseDate($item.find(".date").text(), "YYYY-MM-DD"), 8)
};
});
const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
if (!item.link.includes("/article.jsp")) {
const $ = load(await rofetch(item.link));
return {
...item,
description: $("#vsb_content").html()
};
}
return item;
})));
return {
title: "南京工业大学教务处 - 公告通知",
link,
item: items
};
}
//#endregion
export { route };