rsshub
Version:
Make RSS Great Again!
39 lines (38 loc) • 1.3 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/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 $ = load(await rofetch(baseUrl));
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 article = load(await rofetch(link));
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 };