From 98cfccb65d8202e01d20937cef533d43fbb5a4fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=81=AA=E6=98=8E=E7=9A=84=E9=AD=8F=E5=87=A1?= <74492507+ningyougan@users.noreply.github.com> Date: Sat, 29 Apr 2023 10:41:44 +0800 Subject: [PATCH] feat: add HNU careers feed (#12405) * feat: hnu careers init * docs: update hnu careers * feat: update format information * style: format code * feat: add docs * fix: radar * fix: radar url * feat: rm mock * docs: add API note * fix: link to careers page * fix: link to career page * style: validate --- docs/university.md | 6 ++++++ lib/v2/hnu/careers.js | 33 +++++++++++++++++++++++++++++++++ lib/v2/hnu/maintainer.js | 3 +++ lib/v2/hnu/radar.js | 12 ++++++++++++ lib/v2/hnu/router.js | 3 +++ 5 files changed, 57 insertions(+) create mode 100644 lib/v2/hnu/careers.js create mode 100644 lib/v2/hnu/maintainer.js create mode 100644 lib/v2/hnu/radar.js create mode 100644 lib/v2/hnu/router.js diff --git a/docs/university.md b/docs/university.md index a0e8ed8ed..d7a9c24c7 100644 --- a/docs/university.md +++ b/docs/university.md @@ -1424,6 +1424,12 @@ category 列表: jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS_REJECT_UNAUTHORIZED = 0 ::: +## 湖南大学 + +### 校园招聘 + + + ## 湖南科技大学 ### 教务处通知 diff --git a/lib/v2/hnu/careers.js b/lib/v2/hnu/careers.js new file mode 100644 index 000000000..acbafffa8 --- /dev/null +++ b/lib/v2/hnu/careers.js @@ -0,0 +1,33 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const rootUrl = 'http://scc.hnu.edu.cn/'; + // 校园招聘的路由为/module/getcareers,但该页面默认仅加载整体框架,具体的招聘信息在页面加载完成后再交易获取。 + // 具体的交易可以通过f12,网络栏进行查看,项目中仅保留了必须携带的参数。 + // 其中有用的参数为count,为获取招聘信息的数量。 + const currentRoute = `${rootUrl}module/getcareers`; + const currentUrl = `${currentRoute}?start_page=1&type=inner&day=&count=20&start=1`; + const response = await got({ + method: 'get', + url: currentUrl, + }); + const company_list = response.data.data; + + ctx.state.data = { + title: '校园招聘', + link: currentRoute, + item: company_list.map((company_info) => { + const ret = { + // 标题:公司名称 + title: company_info.company_name, + // 链接:公司招聘简章链接 + link: `${rootUrl}detail/career?id=${company_info.career_talk_id}`, + // 描述:校招教室+时间+专业 + description: company_info.address + ' - ' + company_info.meet_time + ' - ' + company_info.professionals, + // 分类:公司类型(私营、国企)+ 工作城市 + category: company_info.company_property + ' - ' + company_info.city_name, + }; + return ret; + }), + }; +}; diff --git a/lib/v2/hnu/maintainer.js b/lib/v2/hnu/maintainer.js new file mode 100644 index 000000000..808bcc86e --- /dev/null +++ b/lib/v2/hnu/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/careers': ['ningyougan'], +}; diff --git a/lib/v2/hnu/radar.js b/lib/v2/hnu/radar.js new file mode 100644 index 000000000..564483ece --- /dev/null +++ b/lib/v2/hnu/radar.js @@ -0,0 +1,12 @@ +module.exports = { + 'hnu.edu.cn': { + _name: '湖南大学', + scc: [ + { + title: '校园招聘', + docs: 'https://docs.rsshub.app/university.html#hu-nan-da-xue', + target: '/hnu/careers', + }, + ], + }, +}; diff --git a/lib/v2/hnu/router.js b/lib/v2/hnu/router.js new file mode 100644 index 000000000..fecde879a --- /dev/null +++ b/lib/v2/hnu/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/careers', require('./careers')); +};