rsshub
Version:
Make RSS Great Again!
45 lines (44 loc) • 1.62 kB
JavaScript
import { t as rofetch } from "./ofetch-eUBdfMpp.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/chsi/zszcgd.ts
const route = {
path: "/zszcgd/:category?",
categories: ["study"],
example: "/chsi/zszcgd",
parameters: { category: "分类,默认为招生政策" },
name: "教育部阳光高考信息公开平台招生政策规定",
maintainers: ["nczitzk"],
description: `| 招生政策 | 深化考试招生制度改革 | 教育法律法规 |
| -------- | -------------------- | ------------ |
| dnzszc | zdgg | jyflfg |`,
handler
};
async function handler(ctx) {
const { category = "dnzszc" } = ctx.req.param();
const rootUrl = "https://gaokao.chsi.com.cn";
const currentUrl = `${rootUrl}/gkxx/zszcgd/${category}`;
const $ = load(await rofetch(currentUrl));
const list = $(".list ul li a").slice(0, 15).toArray().map((item) => {
const $item = $(item);
const link = $item.attr("href");
return {
title: $item.text(),
pubDate: timezone(parseDate($item.prev().text()), 8),
link: link.includes("http") ? link : `${rootUrl}${link}`
};
});
const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
item.description = load(await rofetch(item.link))(".list").html();
return item;
})));
return {
title: `${$(".backb").text()} - 教育部阳光高考信息公开平台`,
link: currentUrl,
item: items
};
}
//#endregion
export { route };