UNPKG

rsshub

Version:
31 lines (30 loc) 983 B
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs"; import { t as cache_default } from "./cache-C1Y-9qDV.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 response = await rofetch(url); const $ = load(response); 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 () => { const detailResponse = await rofetch(item.link); item.description = load(detailResponse)("#content > form").html(); return item; }))); return { title: `${title} - 北华航天工业学院`, link: url, description: `${title} - 北华航天工业学院`, item: items }; } //#endregion export { fetchList as t };