diff --git a/lib/routes/nwpu/jsj.ts b/lib/routes/nwpu/jsj.ts new file mode 100644 index 000000000000..c6fdf8352190 --- /dev/null +++ b/lib/routes/nwpu/jsj.ts @@ -0,0 +1,74 @@ +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +export const route: Route = { + path: '/jsj/:channelId?', + categories: ['university'], + example: '/nwpu/jsj/1599', + parameters: { channelId: '栏目 ID,默认为 1599(通知公告)' }, + features: { + requireConfig: false, + requirePuppeteer: false, + antiCrawler: false, + supportBT: false, + supportPodcast: false, + supportScihub: false, + }, + radar: [ + { + source: ['jsj.nwpu.edu.cn/snew/list.jsp'], + target: '/jsj/1599', + }, + ], + name: '计算机学院通知公告', + maintainers: [], + handler, +}; + +async function handler(ctx) { + const channelId = ctx.req.param('channelId') || '1599'; + const baseUrl = 'https://jsj.nwpu.edu.cn'; + const listUrl = `${baseUrl}/snew/list.jsp`; + + const response = await ofetch(listUrl, { + query: { + urltype: 'tree.TreeTempUrl', + wbtreeid: channelId, + }, + }); + + const $ = load(response); + + // 内容在