rsshub
Version:
Make RSS Great Again!
42 lines (41 loc) • 1.33 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 { load } from "cheerio";
//#region lib/routes/usst/jwc.ts
const route = {
path: "/jwc",
categories: ["university"],
example: "/usst/jwc",
name: "教务处",
maintainers: ["Diffumist"],
handler
};
async function handler() {
const host = "https://jwc.usst.edu.cn";
const $ = load(await rofetch(host));
const items = await Promise.all($("#container-2 .news").toArray().map((item) => {
const $item = $(item);
const title = $item.find(".news_title a").text();
const pubDate = parseDate($item.find(".news_date").text());
const singleUrl = new URL($item.find(".news_title a").attr("href"), host).href;
return cache_default.tryGet(singleUrl, async () => {
const singleItem = {
title,
link: singleUrl,
pubDate
};
if (new URL(singleUrl).hostname === "webpro.usst.edu.cn") return singleItem;
singleItem.description = load(await rofetch(singleUrl, { ignoreResponseError: true }))(".wp_articlecontent").html();
return singleItem;
});
}));
return {
title: "上海理工大学 - 教务处",
link: `${host}/`,
description: "上海理工大学 - 教务处",
item: items
};
}
//#endregion
export { route };