UNPKG

rsshub

Version:
29 lines (28 loc) 914 B
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as cache_default } from "./cache-CiDoUSLo.mjs"; import { load } from "cheerio"; //#region lib/routes/nciae/utils.ts const baseUrl = "https://nciae.edu.cn"; async function fetchList(path, title) { const url = `${baseUrl}/index/${path}.htm`; const $ = load(await rofetch(url)); const list = $("#container > ul > li > a").toArray().map((item) => { const $item = $(item); return { title: $item.text(), link: new URL($item.attr("href"), url).href }; }); const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { item.description = load(await rofetch(item.link))("#content > form").html(); return item; }))); return { title: `${title} - 北华航天工业学院`, link: url, description: `${title} - 北华航天工业学院`, item: items }; } //#endregion export { fetchList as t };