UNPKG

rsshub

Version:
78 lines (75 loc) 2.26 kB
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 { 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 art } from "./render-BQo6B4tL.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import path from "node:path"; //#region lib/routes/swjtu/utils.ts init_esm_shims(); const renderDetail = (jobs) => art(path.join(__dirname, "templates/job_detail-9764f9b7.art"), { jobs }); const renderDesc = (intro) => art(path.join(__dirname, "templates/job_desc-ede094b1.art"), { intro, job_list: renderDetail(intro.zwxxList) }); const descpPage = (link, cache) => cache.tryGet(link, async () => { const intro = (await got_default({ method: "post", url: link })).data.data; return { title: `${intro.dwmc}${intro.xzyjmc})`, pubDate: parseDate(String(intro.fbrq)), description: renderDesc(intro), link: String(link.replace("data", "view")) }; }); var utils_default = { descpPage, renderDetail, renderDesc }; //#endregion //#region lib/routes/swjtu/jyzpxx.ts const rootURL = "https://jiuye.swjtu.edu.cn/career"; const route = { path: "/jyzpxx", categories: ["university"], example: "/swjtu/jyzpxx", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: true, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["jiuye.swjtu.edu.cn/career", "jiuye.swjtu.edu.cn/"] }], name: "就业招聘信息", maintainers: ["qizidog"], handler, url: "jiuye.swjtu.edu.cn/career" }; async function handler(ctx) { const list = (await got_default({ method: "post", url: `${rootURL}/zpxx/search/zpxx/1/${Math.min(ctx.req.query("limit") ?? 10, 50)}` })).data.data.list; const items = await Promise.all(list.map((item) => { const key = `${rootURL}/zpxx/data/zpxx/${item.zpxxid}`; return utils_default.descpPage(key, cache_default); })); return { title: "西南交大-就业招聘信息", link: `${rootURL}/zpxx/zpxx`, item: items, allowEmpty: true }; } //#endregion export { route };