rsshub
Version:
Make RSS Great Again!
44 lines (43 loc) • 1.37 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/ahut/jwc.ts
const route = {
path: "/jwc",
categories: ["university"],
example: "/ahut/jwc",
name: "教务处",
maintainers: ["Diffumist"],
handler
};
async function handler() {
const link = "https://jwc.ahut.edu.cn/list.jsp?urltype=tree.TreeTempUrl&wbtreeid=1082";
const $ = load(await rofetch(link));
const list = $(".winstyle16974 a.c16974").toArray().map((item) => {
const a = $(item);
return {
title: a.attr("title"),
link: new URL(a.attr("href"), "https://jwc.ahut.edu.cn/").href,
pubDate: timezone(parseDate(a.closest("tr").find(".timestyle16974").text().trim(), "YYYY/MM/DD"), 8)
};
});
return {
title: "安徽工业大学 - 教务处",
link,
description: "安徽工业大学 - 教务处",
item: await Promise.all(list.map((item) => {
if (!new URL(item.link).hostname.endsWith(".ahut.edu.cn")) return item;
return cache_default.tryGet(item.link, async () => {
const $ = load(await rofetch(item.link));
return {
...item,
description: $(".v_news_content").html()
};
});
}))
};
}
//#endregion
export { route };