rsshub
Version:
Make RSS Great Again!
38 lines (37 loc) • 1.16 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.mjs";
import { load } from "cheerio";
//#region lib/routes/lntu/jwnews.ts
const route = {
path: "/jwnews",
categories: ["university"],
example: "/lntu/jwnews",
name: "教务公告",
maintainers: ["ikvarxt"],
handler
};
async function handler() {
const link = "https://jwzx.lntu.edu.cn/index/jwgg.htm";
const $ = load(await rofetch(link));
const items = $(".list3 li").toArray().map((item) => {
const itemLink = new URL($("a", item).attr("href"), link).href;
return cache_default.tryGet(itemLink, async () => {
const $article = load(await rofetch(itemLink));
$article("img, div, span, p, table, td, tr").removeAttr("style");
$article("style").remove();
return {
title: $article("title").text().split("-", 1)[0],
description: $article(".v_news_content").html().replaceAll(/(<span[^>]*>|<\/span>)/g, ""),
link: itemLink,
author: "辽宁工程技术大学教务处"
};
});
});
return {
title: "辽宁工程技术大学教务公告",
link,
item: await Promise.all(items)
};
}
//#endregion
export { route };