Add 中国科学院大学 (#8733)
Co-authored-by: Tony <TonyRL@users.noreply.github.com>
This commit is contained in:
parent
1fbcede90b
commit
42ac513d99
|
|
@ -2641,6 +2641,18 @@ type 列表:
|
|||
|
||||
<Route author="nczitzk" example="/cas/iee/kydt" path="/cas/iee/kydt"/>
|
||||
|
||||
## 中国科学院大学
|
||||
|
||||
### 招聘信息
|
||||
|
||||
<Route author="Fatpandac" example="/ucas/job" path="/ucas/job/:type?" :paramsDesc="['招聘类型,默认为博士后']">
|
||||
|
||||
| 招聘类型 | 博士后 | 课题项目聘用 | 管理支撑人才 | 教学科研人才 |
|
||||
| :------: | :----: | :----------: | :----------: | :----------: |
|
||||
| 参数 | bsh | ktxmpy | glzcrc | jxkyrc |
|
||||
|
||||
</Route>
|
||||
|
||||
## 中国农业大学
|
||||
|
||||
### 中国农业大学研招网通知公告
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const rootUrl = 'https://zhaopin.ucas.ac.cn';
|
||||
|
||||
const idMap = {
|
||||
jxkyrc: 3,
|
||||
glzcrc: 4,
|
||||
ktxmpy: 5,
|
||||
bsh: 6,
|
||||
};
|
||||
|
||||
const titleMap = {
|
||||
jxkyrc: '教学科研人才',
|
||||
glzcrc: '管理支撑人才',
|
||||
ktxmpy: '课题项目聘用',
|
||||
bsh: '博士后',
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type ?? 'bsh';
|
||||
const url = `${rootUrl}/gjob/login.do?method=contentList&t=zhaopin&c=${idMap[type]}`;
|
||||
const response = await got.get(url);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('#col1_content > div.list > ul > li').get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const title = $(item).find('a').attr('title');
|
||||
const link = rootUrl + $(item).find('a').attr('href');
|
||||
const pubDate = parseDate($(item).find('span').text());
|
||||
|
||||
const desc = await ctx.cache.tryGet(link, async () => {
|
||||
const response = await got.get(link);
|
||||
const pageContent = cheerio.load(response.data);
|
||||
|
||||
const descDeadline = pageContent('#col1_content > div.content_head > div.top').html();
|
||||
const descContent = pageContent('#col1_content > div.entry').html();
|
||||
const desc = descDeadline + descContent;
|
||||
return desc;
|
||||
});
|
||||
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
pubDate,
|
||||
description: desc,
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `中国科学院大学招聘 - ${titleMap[type]}`,
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/job/:type?': ['Fatpandac'],
|
||||
};
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
module.exports = {
|
||||
'ucas.ac.cn': {
|
||||
_name: '中国科学院大学招聘',
|
||||
zhaopin: [
|
||||
{
|
||||
title: '招聘信息-博士后',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhong-guo-ke-xue-yuan-da-xue-zhao-pin-xin-xi',
|
||||
source: '/*',
|
||||
target: (params, url) => {
|
||||
if (new URL(url).searchParams.get('c') === '6') {
|
||||
return '/ucas/job/bsh';
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '招聘信息-课题项目聘用',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhong-guo-ke-xue-yuan-da-xue-zhao-pin-xin-xi',
|
||||
source: '/*',
|
||||
target: (params, url) => {
|
||||
if (new URL(url).searchParams.get('c') === '5') {
|
||||
return '/ucas/job/ktxmpy';
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '招聘信息-管理支撑人才',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhong-guo-ke-xue-yuan-da-xue-zhao-pin-xin-xi',
|
||||
source: '/*',
|
||||
target: (params, url) => {
|
||||
if (new URL(url).searchParams.get('c') === '4') {
|
||||
return '/ucas/job/glzcrc';
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '招聘信息-科学科研人才',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhong-guo-ke-xue-yuan-da-xue-zhao-pin-xin-xi',
|
||||
source: '/*',
|
||||
target: (params, url) => {
|
||||
if (new URL(url).searchParams.get('c') === '3') {
|
||||
return '/ucas/job/jxkyrc';
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/job/:type?', require('./index'));
|
||||
};
|
||||
Loading…
Reference in New Issue