rsshub
Version:
Make RSS Great Again!
72 lines (70 loc) • 2.3 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/njit/tzgg.ts
const url = "https://www.njit.edu.cn/index/tzgg.htm";
const host = "https://www.njit.edu.cn";
const route = {
path: "/tzgg",
categories: ["university"],
example: "/njit/tzgg",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["www.njit.edu.cn/"] }],
name: "南京工程学院通知公告",
maintainers: ["zefengdaguo"],
handler,
url: "www.njit.edu.cn/"
};
async function handler() {
const $ = load((await got_default({
method: "get",
url,
https: { rejectUnauthorized: false }
})).body);
const urlList = $("body").find("span.text a").toArray().map((e) => $(e).attr("href"));
const titleList = $("body").find("span.text a").toArray().map((e) => $(e).attr("title"));
const dateList = $("body").find("span.date").toArray().map((e) => "20" + $(e).text().slice(1, 9));
return {
title: "南京工程学院 -- 通知公告",
url,
item: await Promise.all(urlList.map((itemUrl, index) => {
itemUrl = new URL(itemUrl, host).href;
if (itemUrl.includes("content.jsp")) return {
title: titleList[index],
link: itemUrl,
description: "该通知仅限校内访问,请点击原文链接↑",
pubDate: parseDate(dateList[index])
};
else return cache_default.tryGet(itemUrl, async () => {
const $$1 = load((await got_default({
method: "get",
url: itemUrl,
https: { rejectUnauthorized: false }
})).body);
return {
title: $$1("title").text(),
link: itemUrl,
description: $$1(".v_news_content").html().replaceAll("src=\"/", `src="${new URL(".", host).href}`).replaceAll("href=\"/", `href="${new URL(".", host).href}`).trim(),
pubDate: parseDate($$1(".link_1").text().slice(6, 16))
};
});
}))
};
}
//#endregion
export { route };