UNPKG

rsshub

Version:
46 lines (45 loc) 1.44 kB
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs"; import { t as parseDate } from "./parse-date-3kcy2Eau.mjs"; import { t as cache_default } from "./cache-C1Y-9qDV.mjs"; import { t as timezone } from "./timezone-UiMFOuvL.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 response = await rofetch(link); const $ = load(response); 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 detailResponse = await rofetch(item.link); const $ = load(detailResponse); return { ...item, description: $(".v_news_content").html() }; }); })) }; } //#endregion export { route };