rsshub
Version:
Make RSS Great Again!
40 lines (39 loc) • 1.28 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.mjs";
import { t as timezone } from "./timezone-DE--ze1V.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 $ = load(await rofetch(url));
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 () => {
item.description = load(await rofetch(item.link))(".wp_articlecontent").html();
return item;
}))),
description: "中国药科大学 | 研究生院"
};
}
//#endregion
export { route };