From 33a43d3fe212e4a6d040a1018f62d88cbeb60610 Mon Sep 17 00:00:00 2001 From: Zebartin <16185081+Zebartin@users.noreply.github.com> Date: Fri, 8 Mar 2024 21:11:45 +0800 Subject: [PATCH] fix(route): /pku/scc/recruit (#14713) * fix(route): /pku/scc/recruit * refactor: camelCase --------- Co-authored-by: Tony --- lib/routes/pku/scc/recruit.ts | 15 +++++++-------- website/docs/routes/university.mdx | 8 ++++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/routes/pku/scc/recruit.ts b/lib/routes/pku/scc/recruit.ts index 0a4386214..a06d66172 100644 --- a/lib/routes/pku/scc/recruit.ts +++ b/lib/routes/pku/scc/recruit.ts @@ -7,8 +7,7 @@ const arr = { xwrd: 'home!newsHome.action?category=12', tzgg: 'home!newsHome.action?category=13', zpxx: 'home!recruit.action?category=1&jobType=110001', - gfjgxx: 'home!recruitList.action?category=1&jobType=110002', - sxxx: 'home!recruitList.action?category=2', + sxxx: 'home!recruitList.action?category=2&jobType=110001', cyxx: 'home!newsHome.action?category=11', }; const baseUrl = 'https://scc.pku.edu.cn/'; @@ -17,8 +16,8 @@ export default async (ctx) => { const type = ctx.req.param('type') ?? 'zpxx'; const rootUrl = baseUrl + arr[type]; - const list_response = await got(rootUrl); - const $ = load(list_response.data); + const listResponse = await got(rootUrl); + const $ = load(listResponse.data); const feed_title = $('h2.category').text(); @@ -29,7 +28,7 @@ export default async (ctx) => { const date = parseDate(item.find('div.item-date').text()); return { title: a.text(), - link: new URL(a.attr('href'), baseUrl), + link: new URL(a.attr('href'), baseUrl).href, pubDate: date, }; }) @@ -43,9 +42,9 @@ export default async (ctx) => { item: await Promise.all( sorted.map((item) => cache.tryGet(item.link, async () => { - const detail_page = await got(item.link); - const detail = load(detail_page.data); - const script = detail('script', 'div#content-div').html(); + const detailPage = await got(item.link); + const detail = load(detailPage.data); + const script = detail('div#content-div script').html(); if (script !== null) { const content_route = script.match(/\$\("#content-div"\).load\("(\S+)"\)/)[1]; const content = await got(new URL(content_route, baseUrl).href); diff --git a/website/docs/routes/university.mdx b/website/docs/routes/university.mdx index 53fa79c1c..2849402a2 100644 --- a/website/docs/routes/university.mdx +++ b/website/docs/routes/university.mdx @@ -283,10 +283,10 @@ Note:[Source website](https://ece.umass.edu/seminar) may be empty when there's ### 学生就业指导服务中心 {#bei-jing-da-xue-xue-sheng-jiu-ye-zhi-dao-fu-wu-zhong-xin} - - | xwrd | tzgg | zpxx | gfjgxx | sxxx | cyxx | - | -------- | -------- | -------- | ------------ | -------- | -------- | - | 新闻热点 | 通知公告 | 招聘信息 | 国防军工信息 | 实习信息 | 创业信息 | + + | xwrd | tzgg | zpxx | sxxx | cyxx | + | -------- | -------- | -------- | -------- | -------- | + | 新闻热点 | 通知公告 | 招聘信息 | 实习信息 | 创业信息 | ### 人事处 {#bei-jing-da-xue-ren-shi-chu}