rsshub
Version:
Make RSS Great Again!
41 lines (40 loc) • 1.37 kB
JavaScript
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/dlu/jiaowu/news.ts
const baseUrl = "https://jwc1.dlu.edu.cn/";
const route = {
path: "/jiaowu/news",
categories: ["university"],
example: "/dlu/jiaowu/news",
name: "教务处信息",
maintainers: ["SettingDust"],
handler
};
async function handler() {
const response = await rofetch(baseUrl);
const $ = load(response);
const items = $("td[valign=\"top\"]>table[cellspacing=\"3\"][width=\"100%\"] tr").toArray().map((elem) => {
const a = $("a", elem);
const link = new URL(a.attr("href"), baseUrl).href;
return cache_default.tryGet(link, async () => {
const detailResponse = await rofetch(link);
const article = load(detailResponse);
return {
link,
title: a.attr("title"),
pubDate: timezone(parseDate(article("td[height=\"28\"]").text(), "YYYY年MM月DD日 HH:mm"), 8),
description: article("form[name=\"_newscontent_fromname\"] > div > *:not(table)").toArray().map((it) => article(it).html()).join("\n")
};
});
});
return {
link: baseUrl,
title: "大连大学教务处",
item: await Promise.all(items)
};
}
//#endregion
export { route };