rsshub
Version:
Make RSS Great Again!
42 lines (41 loc) • 1.34 kB
JavaScript
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs";
import { t as parseDate } from "./parse-date-3kcy2Eau.mjs";
import { t as cache_default } from "./cache-C1Y-9qDV.mjs";
import { t as timezone } from "./timezone-UiMFOuvL.mjs";
import { load } from "cheerio";
//#region lib/routes/cpu/yjsy.ts
const route = {
path: "/yjsy",
categories: ["university"],
example: "/cpu/yjsy",
name: "研究生院",
maintainers: ["kba977"],
handler
};
async function handler() {
const baseUrl = "https://yjsy.cpu.edu.cn";
const url = `${baseUrl}/6335/list.htm`;
const response = await rofetch(url);
const $ = load(response);
const list = $("ul.news_list li.news").slice(0, 10).toArray().map((item) => {
const $item = $(item);
const a = $item.find(".news_title a");
return {
title: a.attr("title"),
link: new URL(a.attr("href"), baseUrl).href,
pubDate: timezone(parseDate($item.find(".news_meta").text(), "YYYY-MM-DD"), 8)
};
});
return {
title: "中国药科大学 - 研究生院 | 最新通知",
link: url,
item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
const detail = await rofetch(item.link);
item.description = load(detail)(".wp_articlecontent").html();
return item;
}))),
description: "中国药科大学 | 研究生院"
};
}
//#endregion
export { route };