rsshub
Version:
Make RSS Great Again!
72 lines (70 loc) • 2.28 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
import { t as cache_default } from "./cache-Bo__VnGm.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import { n as finishArticleItem } from "./wechat-mp-Dq_pp853.mjs";
import { load } from "cheerio";
//#region lib/routes/sdu/cs/yjsgz.ts
const host = "https://csyh.sdu.edu.cn/";
const typeMap = {
zytz: "zytz.htm",
gsl: "gsl.htm"
};
const titleMap = {
zytz: "重要通知",
gsl: "公示栏"
};
const route = {
path: "/cs/yjsgz/:type?",
categories: ["university"],
example: "/sdu/cs/yjsgz/zytz",
parameters: { type: "默认为`zytz`" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
name: "计算机科学与技术学院研究生工作网站",
maintainers: ["kukeya", "wiketool"],
handler,
description: `| 重要通知 | 公示栏 |
| -------- | -------- |
| zytz | gsl |`
};
async function handler(ctx) {
const type = ctx.req.param("type") ?? "zytz";
const link = new URL(typeMap[type], host).href;
const $ = load((await got_default(link)).data);
let item = $(".ss li").toArray().map((e) => {
e = $(e);
const a = e.find("a");
return {
title: a.text().trim(),
link: a.attr("href").startsWith("info/") ? host + a.attr("href") : a.attr("href"),
pubDate: parseDate(e.find("span").text().trim(), "YYYY-MM-DD")
};
});
item = await Promise.all(item.map((item$1) => cache_default.tryGet(item$1.link, async () => {
if (new URL(item$1.link).hostname === "mp.weixin.qq.com") return finishArticleItem(item$1);
item$1.description = load((await got_default(item$1.link)).data)(".v_news_content").html();
return item$1;
})));
return {
title: `山东大学计算机科学与技术学院研究生工作网站${titleMap[type]}`,
description: $("title").text(),
link,
item,
icon: "https://assets.i-scmp.com/static/img/icons/scmp-icon-256x256.png",
logo: "https://assets.i-scmp.com/static/img/icons/scmp-icon-256x256.png"
};
}
//#endregion
export { route };