rsshub
Version:
Make RSS Great Again!
62 lines (61 loc) • 2.16 kB
JavaScript
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.mjs";
import { t as got_default } from "./got-BDnf4rdT.mjs";
import { load } from "cheerio";
//#region lib/routes/sass/gs/index.ts
const host = "https://gs.sass.org.cn";
const route = {
path: "/gs/:type",
categories: ["university"],
example: "/sass/gs/1793",
parameters: { type: "类别 ID,见下表,其他未列出的栏目参数可以从页面的 URL Path 中找到,例如:硕士统考招生的网址为 `https://gs.sass.org.cn/1793/list.htm`,则类别 ID 为`1793`" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["gs.sass.org.cn/:type/list.htm"] }],
name: "研究生院",
maintainers: ["yanbot-team"],
handler,
description: `| 硕士统考招生 | 硕士推免招生 |
| ------------ | ------------ |
| 1793 | sstmzs |`
};
async function handler(ctx) {
const type = ctx.req.param("type");
const url = `${host}/${type}/list.htm`;
const $ = load((await got_default(url)).data);
const list = $(".column-news-list .cols_list .cols");
return {
title: "上海社会科学院 - 研究生院",
link: url,
description: "上海社会科学院 - 研究生院",
item: await Promise.all(list.map((i, item) => {
const $children = $(item).children();
const itemDate = $children.eq(1).text();
const $titleLink = $children.eq(0).children().first();
const path = $titleLink.attr("href");
const itemTitle = $titleLink.attr("title");
const itemUrl = path.startsWith("http") ? path : host + path;
return cache_default.tryGet(itemUrl, async () => {
let description;
if (itemUrl) {
const $ = load((await got_default(itemUrl)).data);
description = $(".read .wp_articlecontent").length ? $(".read .wp_articlecontent").html() : itemTitle;
} else description = itemTitle;
return {
title: itemTitle,
link: itemUrl,
description,
pubDate: parseDate(itemDate, "YYYY-MM-DD")
};
});
}))
};
}
//#endregion
export { route };