UNPKG

rsshub

Version:
61 lines (60 loc) 1.75 kB
import { t as parseDate } from "./parse-date-3kcy2Eau.mjs"; import { t as cache_default } from "./cache-C1Y-9qDV.mjs"; import { t as got_default } from "./got-DUpa1V3-.mjs"; import { t as timezone } from "./timezone-UiMFOuvL.mjs"; import { load } from "cheerio"; //#region lib/routes/ahjzu/news.ts const route = { path: "/news", categories: ["university"], example: "/ahjzu/news", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["news.ahjzu.edu.cn/20/list.htm"] }], name: "通知公告", maintainers: ["Yuk-0v0"], handler, url: "news.ahjzu.edu.cn/20/list.htm" }; async function handler() { const rootUrl = "https://www.ahjzu.edu.cn"; const currentUrl = "https://www.ahjzu.edu.cn/20/list.htm"; const response = await got_default({ method: "get", url: currentUrl }); const $ = load(response.data); const list = $("#wp_news_w9").find("li").toArray().map((item) => { const $item = $(item); const date = $item.find(".column-news-date").text(); const a = $item.find("a").attr("href"); const link = a.startsWith("http") ? a : rootUrl + a; return { title: $item.find("a").attr("title"), link, pubDate: timezone(parseDate(date), 8) }; }); return { title: "安建大-通知公告", description: "安徽建筑大学-通知公告", link: currentUrl, item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const detailResponse = await got_default({ method: "get", url: item.link }); item.description = load(detailResponse.data)(".wp_articlecontent").html(); return item; }))) }; } //#endregion export { route };