rsshub
Version:
Make RSS Great Again!
61 lines (59 loc) • 1.85 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as art } from "./render-BQo6B4tL.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import path from "node:path";
import { load } from "cheerio";
import iconv from "iconv-lite";
//#region lib/routes/gov/sh/rsj/ksxm.ts
init_esm_shims();
const rootUrl = "http://www.rsj.sh.gov.cn";
const route = {
path: ["/sh/rsj/ksxm", "/shanghai/rsj/ksxm"],
categories: ["government"],
example: "/gov/sh/rsj/ksxm",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["rsj.sh.gov.cn/"] }],
name: "上海市职业能力考试院 考试项目",
maintainers: ["Fatpandac"],
handler,
url: "rsj.sh.gov.cn/"
};
async function handler() {
const url = `${rootUrl}/ksyzc/wangz/kwaplist_300.jsp`;
const response = await got_default({
method: "get",
url,
responseType: "buffer"
});
const $ = load(iconv.decode(response.data, "gbk"));
return {
title: "上海市职业能力考试院 - 考试项目",
link: url,
item: $("kwap").toArray().map((item) => ({
title: $(item).find("kaosxmmc").text(),
link: `http://www.rsj.sh.gov.cn/ksyzc/index801.jsp`,
description: art(path.join(__dirname, "templates/ksxm-fa4b3d4b.art"), {
name: $(item).find("kaosxmmc").text(),
type: $(item).find("kaoslb_dmfy").text(),
date: $(item).find("kaosrq").text(),
registrationDeadline: $(item).find("baomksrq_A300").text()
}),
guid: `${$(item).find("kaosrq").text()}${$(item).find("kaosxmmc").text()}`
}))
};
}
//#endregion
export { route };