rsshub
Version:
Make RSS Great Again!
41 lines (40 loc) • 1.27 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/zjgsu/tzgg.ts
const route = {
path: "/tzgg",
categories: ["university"],
example: "/zjgsu/tzgg",
name: "新闻网 - 通知公告",
maintainers: ["nicolaszf"],
handler
};
const host = "http://news.zjgsu.edu.cn";
const link = `${host}/18/`;
async function handler() {
const $ = load(await rofetch(link));
const list = $("ul.list-1 li").toArray().map((item) => {
const $item = $(item);
const a = $item.find("a");
return {
title: a.text(),
link: new URL(a.attr("href"), host).href,
pubDate: timezone(parseDate($item.find("span.fr").text()), 8)
};
});
const items = await Promise.all(list.map((item) => item.link.startsWith(`${host}/`) ? cache_default.tryGet(item.link, async () => {
item.description = load(await rofetch(item.link))("#the_content").html();
return item;
}) : item));
return {
title: "浙江工商大学新闻网-通知公告",
link,
description: "浙江工商大学新闻网-通知公告",
item: items
};
}
//#endregion
export { route };