UNPKG

rsshub

Version:
45 lines (44 loc) 1.36 kB
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs"; import { t as parseDate } from "./parse-date-3kcy2Eau.mjs"; import { t as cache_default } from "./cache-C1Y-9qDV.mjs"; import { t as timezone } from "./timezone-UiMFOuvL.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 response = await rofetch(link); const $ = load(response); 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 detailResponse = await rofetch(item.link); const $ = load(detailResponse); return { ...item, description: $(".v_news_content").html() }; }))) }; } //#endregion export { route };