rsshub
Version:
Make RSS Great Again!
43 lines (42 loc) • 1.48 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/dlmu/grs/zsgz.ts
const route = {
path: "/grs/zsgz/:type",
categories: ["university"],
example: "/dlmu/grs/zsgz/ssyjs",
parameters: { type: "招生类别" },
name: "研究生院 - 招生工作",
maintainers: ["nczitzk"],
handler,
description: `| 博士研究生 | 硕士研究生 | 同等学力攻读硕士学位 | 港澳台地区招生 |
| :--------: | :--------: | :------------------: | :------------: |
| bsyjs | ssyjs | tdxlgdssxw | gatdqzs |`
};
async function handler(ctx) {
const { type } = ctx.req.param();
const link = `http://grs.dlmu.edu.cn/zsgz/${type}.htm`;
const $ = load(await rofetch(link));
const list = $("div.main_conRCb ul li").toArray().map((item) => {
const $item = $(item);
const a = $item.find("a");
return {
title: a.text(),
link: new URL(a.attr("href"), link).href,
pubDate: timezone(parseDate($item.find("span").text()), 8)
};
});
return {
title: $("title").text(),
link,
item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
item.description = load(await rofetch(item.link))("div.main_conDiv").html();
return item;
})))
};
}
//#endregion
export { route };