UNPKG

rsshub

Version:
48 lines (47 loc) 1.42 kB
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs"; import { t as parseDate } from "./parse-date-3kcy2Eau.mjs"; import { t as cache_default } from "./cache-C1Y-9qDV.mjs"; import { load } from "cheerio"; //#region lib/routes/tsinghua/career.ts const baseUrl = "https://career.cic.tsinghua.edu.cn/"; const path = "xsglxt/f/jyxt/anony/xxfb"; const route = { path: "/career", categories: ["university"], example: "/tsinghua/career", name: "招聘信息", maintainers: ["Halcao", "DylanXie123"], handler }; async function handler() { const link = baseUrl + path; const response = await rofetch(link, { method: "POST", body: new URLSearchParams({ pgno: "1" }) }); const $ = load(response); const list = $("#ts_div .list li").toArray().map((item) => { const $item = $(item); const a = $item.find("a"); return { title: a.text(), link: new URL(a.attr("ahref"), baseUrl).href, pubDate: parseDate($item.find("span").text()) }; }); return { title: "清华大学 - 招聘信息", link, description: "清华大学学生职业发展指导中心 - 招聘信息", item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const detailResponse = await rofetch(item.link); const $detail = load(detailResponse); return { ...item, description: $detail("div.sideleft.left, div.content.teacher").html() }; }))) }; } //#endregion export { route };