UNPKG

rsshub

Version:
27 lines (26 loc) 954 B
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 { load } from "cheerio"; //#region lib/routes/pku/ss/common.ts const baseUrl = "https://www.ss.pku.edu.cn"; const getSingleRecord = async (url) => { const res = await got_default(url); const $ = load(res.data); return $("#info-list-ul").find("li").toArray().map((item) => { const $item = $(item); const date = $item.find(".time").text(); return { title: $item.find("a").attr("title"), pubDate: parseDate(date), link: baseUrl + $item.find("a").attr("href") }; }); }; const getArticle = (item) => cache_default.tryGet(item.link, async () => { const response = await got_default(item.link); item.description = load(response.data)(".article-content").html(); return item; }); //#endregion export { getArticle as n, getSingleRecord as r, baseUrl as t };