feat(route): add 对外经济贸易大学人力资源处 (#8372)

This commit is contained in:
Ethan Shen
2021-11-27 08:33:50 +00:00
committed by GitHub
parent d82186b990
commit c302a5853e
5 changed files with 89 additions and 0 deletions
+16
View File
@@ -655,6 +655,22 @@ xskb1 对应 <http://www.auto.uestc.edu.cn/index/xskb1.htm>
</Route>
## 对外经济贸易大学
### 人力资源处
<Route author="nczitzk" example="/uibe/hr" path="/uibe/hr/:category?/:type?" :paramsDesc="['分类,可在对应页 URL 中找到,默认为通知公告', '类型,可在对应页 URL 中找到,默认为空']">
::: tip 提示
如 [通知公告](http://hr.uibe.edu.cn/tzgg) 的 URL 为 <http://hr.uibe.edu.cn/tzgg>,其路由为 [`/uibe/hr/tzgg`](https://rsshub.app/uibe/hr/tzgg)
如 [教师招聘](http://hr.uibe.edu.cn/jszp) 中的 [招聘信息](http://hr.uibe.edu.cn/jszp/zpxx) 的 URL 为 <http://hr.uibe.edu.cn/jszp/zpxx>,其路由为 [`/uibe/hr/jszp/zpxx`](https://rsshub.app/uibe/jszp/zpxx)
:::
</Route>
## 福州大学
### 教务处通知
+54
View File
@@ -0,0 +1,54 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const category = ctx.params.category ?? 'tzgg';
const type = ctx.params.type ?? '';
const rootUrl = 'http://hr.uibe.edu.cn';
const currentUrl = `${rootUrl}/${category}${type ? `/${type}` : ''}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.lawul, .longul')
.find('li a')
.map((_, item) => {
item = $(item);
return {
title: item.find('p').text(),
link: `${currentUrl}/${item.attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('.gp-article').html();
item.pubDate = parseDate(content('#shareTitle').next().text().replace('时间:', ''));
return item;
})
)
);
ctx.state.data = {
title: `${$('.picTit').text()} - 对外经济贸易大学人力资源处`,
link: currentUrl,
item: items,
};
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/hr/:category?/:type?': ['nczitzk'],
};
+13
View File
@@ -0,0 +1,13 @@
module.exports = {
'uibe.edu.cn': {
_name: '对外经济贸易大学',
hr: [
{
title: '人力资源处',
docs: 'https://docs.rsshub.app/university.html#dui-wai-jing-ji-mao-yi-da-xue-ren-li-zi-yuan-chu',
source: ['/:category/:type', '/:category', '/'],
target: '/uibe/hr/:category?/:type?',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/hr/:category?/:type?', require('./hr'));
};