UNPKG

rsshub

Version:
56 lines (54 loc) 1.78 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { load } from "cheerio"; //#region lib/routes/pku/cls/announcement.ts const homeUrl = "https://bio.pku.edu.cn/homes/Index/news/21/21.html"; const baseUrl = "https://bio.pku.edu.cn"; const route = { path: "/cls/announcement", categories: ["university"], example: "/pku/cls/announcement", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["bio.pku.edu.cn/homes/Index/news/21/21.html", "bio.pku.edu.cn/"] }], name: "生命科学学院通知公告", maintainers: ["william-swl"], handler, url: "bio.pku.edu.cn/homes/Index/news/21/21.html" }; async function handler() { const $ = load((await got_default(homeUrl)).data); const list = $("div.normal_list>ul a").toArray().map((item) => { item = $(item); return { title: $(item).find("p").text().trim(), pubDate: parseDate($(item).find("span.date").text()), link: baseUrl + $(item).attr("href") }; }); return { title: "北京大学生命科学学院通知公告", link: homeUrl, item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const { data: response } = await got_default(item.link); item.description = load(response)("div.page div.common_width div.col-md-9").first().html(); return item; }))) }; } //#endregion export { route };