rsshub
Version:
Make RSS Great Again!
43 lines (42 loc) • 1.44 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/lit/jwc.ts
const route = {
path: "/jwc",
categories: ["university"],
example: "/lit/jwc",
name: "教务处",
maintainers: ["vhxubo"],
handler
};
const baseUrl = "https://www.lit.edu.cn/jwc/";
async function handler() {
const $ = load(await rofetch(`${baseUrl}xb2024.htm`));
const list = $(".news-content").toArray().map((item) => {
const a = $(item).find("a");
return {
title: a.text(),
link: new URL(a.attr("href"), baseUrl).href
};
});
const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
const $ = load(await rofetch(item.link));
const meta = $(".content-title span:last-child").text();
item.title = $(".content-title span:first-child").text();
item.description = $(".v_news_content").html();
item.pubDate = timezone(parseDate(meta.match(/时间:(\d{4}年\d{2}月\d{2}日 \d{2}:\d{2})/)?.[1] ?? "", "YYYY年MM月DD日 HH:mm"), 8);
item.author = meta.match(/作者:(\S+)/)?.[1];
return item;
})));
return {
title: "教务处 - 洛阳理工学院",
link: baseUrl,
description: "洛阳理工教务在线 RSS",
item: items
};
}
//#endregion
export { route };