UNPKG

rsshub

Version:
49 lines (48 loc) 1.44 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as cache_default } from "./cache-CiDoUSLo.mjs"; import { load } from "cheerio"; //#region lib/routes/cqu/news-jzyg.ts const route = { path: "/news/jzyg", categories: ["university"], example: "/cqu/news/jzyg", name: "新闻网讲座预告", maintainers: ["nicolaszf"], handler }; async function handler() { const url = "https://news.cqu.edu.cn/archives/lecture/index.html"; const $ = load(await rofetch(url)); return { title: "重庆大学新闻网-讲座预告", link: url, description: "重庆大学新闻网-讲座预告", item: await Promise.all($(".item").toArray().map((item) => { const $item = $(item); const $title1 = $item.find(".title a").eq(0); const $title2 = $item.find(".title a").eq(1); let href = $title2.attr("href"); let title = `${$title1.text()} - ${$title2.text()}`; if (href === void 0) { href = $title1.attr("href"); title = $title1.text(); } const itemUrl = new URL(href, url).href; return cache_default.tryGet(itemUrl, async () => { const item = { title, link: itemUrl, guid: itemUrl, description: $item.find(".minfo").html() }; try { const $detail = load(await rofetch(itemUrl)); item.description = ($detail(".dinfo").html() ?? "") + ($detail(".acontent").html() ?? ""); } catch {} return item; }); })) }; } //#endregion export { route };