rsshub
Version:
Make RSS Great Again!
45 lines (44 loc) • 1.43 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/jlbtc/kyc.ts
const route = {
path: "/kyc/:category?",
categories: ["university"],
example: "/jlbtc/kyc",
parameters: { category: "分类,见下表,默认为通知公告" },
name: "科研处",
maintainers: ["nczitzk"],
description: `| 通知公告 | 新闻动态 |
| -------- | -------- |
| tzgg | xwdt |`,
handler
};
async function handler(ctx) {
const { category = "tzgg" } = ctx.req.param();
const rootUrl = "https://kyc.jlbtc.edu.cn";
const currentUrl = `${rootUrl}/${category}.htm`;
const $ = load(await rofetch(currentUrl));
const list = $(".c48101").slice(0, 10).toArray().map((item) => {
const $item = $(item);
return {
title: $item.text(),
link: `${rootUrl}/${$item.attr("href")}`
};
});
const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
const content = load(await rofetch(item.link));
item.description = content("#vsb_content").html();
item.pubDate = timezone(parseDate(content(".timestyle45401").text()), 8);
return item;
})));
return {
title: $("title").text(),
link: currentUrl,
item: items
};
}
//#endregion
export { route };