rsshub
Version:
Make RSS Great Again!
58 lines (56 loc) • 1.94 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 "./helpers-DxBp0Pty.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
//#region lib/routes/nowcoder/schedule.ts
const route = {
path: "/schedule/:propertyId?/:typeId?",
categories: ["bbs"],
example: "/nowcoder/schedule",
parameters: {
propertyId: "行业, 在控制台中抓取接口,可获得行业id,默认0",
typeId: "类别,同上"
},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{
source: ["nowcoder.com/"],
target: "/schedule"
}],
name: "校招日程",
maintainers: ["junfengP"],
handler,
url: "nowcoder.com/"
};
async function handler(ctx) {
const propertyId = ctx.req.param("propertyId") ?? 0;
const responseBody = (await got_default(`https://www.nowcoder.com/school/schedule/data?token=&query=&typeId=${ctx.req.param("typeId") ?? 0}&propertyId=${propertyId}&onlyFollow=false&_=${Date.now()}`)).data;
if (responseBody.code !== 0) throw new Error(`接口错误,错误代码:${responseBody.code},错误原因:${responseBody.msg}`);
return {
title: "名企校招日程",
link: "https://www.nowcoder.com/school/schedule",
description: "名企校招日程",
item: responseBody.data.companyList.map((item) => {
let desc = `<tr><td><img src="${item.logo}" referrerpolicy="no-referrer""></td></tr>`;
for (const each of item.schedules) desc += `<tr><td>${each.content}</td><td>${each.time}</td></tr>`;
return {
title: item.name,
description: `<table>${desc}</table>`,
pubDate: parseDate(item.createTime),
link: `https://www.nowcoder.com/school/schedule/${item.id}`
};
})
};
}
//#endregion
export { route };