UNPKG

rsshub

Version:
43 lines (42 loc) 1.29 kB
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/ahut/news.ts const route = { path: "/news", categories: ["university"], example: "/ahut/news", radar: [{ source: ["news.ahut.edu.cn/xyyw.htm"] }], name: "学校要闻", maintainers: ["Diffumist"], handler, url: "news.ahut.edu.cn/xyyw.htm" }; async function handler() { const link = "https://news.ahut.edu.cn/xyyw.htm"; const $ = load(await rofetch(link)); const list = $(".p2_left_ul li a").toArray().map((item) => { const $item = $(item); return { title: $item.attr("title"), link: new URL($item.attr("href"), link).href, pubDate: timezone(parseDate($item.find(".sj .p2").text(), "YYYY-MM-DD"), 8) }; }); return { title: "安徽工业大学 - 学校要闻", link, description: "安徽工业大学 - 学校要闻", item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const $ = load(await rofetch(item.link)); return { ...item, description: $(".v_news_content").html() }; }))) }; } //#endregion export { route };