UNPKG

rsshub

Version:
66 lines (64 loc) 2.22 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import { t as timezone } from "./timezone-D8cuwzTY.mjs"; import { load } from "cheerio"; //#region lib/routes/gxmzu/lib.ts const url = "https://library.gxmzu.edu.cn/news/news_list.jsp?urltype=tree.TreeTempUrl&wbtreeid=1010"; const host = "https://library.gxmzu.edu.cn"; const route = { path: "/libzxxx", categories: ["university"], example: "/gxmzu/libzxxx", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: true, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["library.gxmzu.edu.cn/news/news_list.jsp", "library.gxmzu.edu.cn/"] }], name: "图书馆最新消息", maintainers: ["real-jiakai"], handler, url: "library.gxmzu.edu.cn/news/news_list.jsp" }; async function handler() { const response = await ofetch_default(url); if (!response) return; const $ = load(response); const list = $("#newslist ul li").toArray().map((item) => { item = $(item); return { title: item.find("a").text(), link: new URL(item.find("a").attr("href"), host).href, pubDate: timezone(parseDate(item.find("span").text(), "YYYY-MM-DD"), 8) }; }); return { title: "广西民族大学图书馆 -- 最新消息", link: url, item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { if (item.link && !item.link.startsWith("https://library.gxmzu.edu.cn/")) { item.description = "该通知无法直接预览,请点击原文链接↑查看"; return item; } const response$1 = await ofetch_default(item.link); if (!response$1 || response$1.status >= 300 && response$1.status < 400) item.description = "该通知无法直接预览,请点击原文链接↑查看"; else { const $$1 = load(response$1); item.title = $$1("h2").text(); item.description = $$1(".v_news_content").html(); } return item; }))) }; } //#endregion export { route };