Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 中南大学招聘信息 #2556

Merged
merged 3 commits into from Jul 4, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/university.md
Expand Up @@ -899,6 +899,18 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet

</Route>

## 中南大学

### 招聘信息

<Route author="csuhan" example="/csu/job/1/1/15" path="/universities/csu/job/:type/:pageindex/:pagesize?" :paramsDesc="['招聘类型','页码','信息数量']">
Copy link
Owner

@DIYgod DIYgod Jul 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSS 只用来获取更新,不应该有 页码 和 信息数量 参数,页面应固定在 1,数量应固定在一个合理数量


| 招聘类型 | 本部招聘 | 湘雅招聘 | 铁道招聘 | 在线招聘 | 事业招考 |
| -------- | -------- | -------- | -------- | -------- | -------- |
| 参数 | 1 | 2 | 3 | 4 | 5 |

</Route>

## 重庆大学

### 教务网通知公告
Expand Down
3 changes: 3 additions & 0 deletions lib/router.js
Expand Up @@ -632,6 +632,9 @@ router.get('/hust/auto/news/', require('./routes/universities/hust/aia/news'));
router.get('/hust/aia/news/', require('./routes/universities/hust/aia/news'));
router.get('/hust/aia/notice/:type?', require('./routes/universities/hust/aia/notice'));

// 中南大学
router.get('/csu/job/:type/:pageindex/:pagesize?', require('./routes/universities/csu/job'));

// 山东大学
router.get('/sdu/sc/:type?', require('./routes/universities/sdu/sc'));
router.get('/sdu/cs/:type?', require('./routes/universities/sdu/cs'));
Expand Down
39 changes: 39 additions & 0 deletions lib/routes/universities/csu/job.js
@@ -0,0 +1,39 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const url = require('url').resolve;

const typeMaps = ['本部招聘', '湘雅招聘', '铁道招聘', '在线招聘', '事业招考'];

module.exports = async (ctx) => {
const type = ctx.params.type || 1;
const pageindex = ctx.params.pageindex || 1;
const pagesize = ctx.params.pagesize || 15;
const link = 'http://jobsky.csu.edu.cn/Home/PartialArticleList';
const response = await got.post(link, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: 'pageindex=' + pageindex + '&pagesize=' + pagesize + '&typeid=' + type + '&followingdates=-1',
});
const $ = cheerio.load('<html><body><table>' + response.data + '</table></body></html>');
const list = $('tr');
ctx.state.data = {
title: '中南大学招聘信息--' + typeMaps[parseInt(type) - 1],
link: link,
description: '中南大学招聘信息',
item:
list &&
list
.map((index, item) => {
item = $(item);
const pubDate = item.find('.spanDate').text();
return {
title: item.find('a').text(),
description: item.find('a').text(),
pubDate: new Date(pubDate).toUTCString(),
link: url('http://jobsky.csu.edu.cn/', item.find('a').attr('href')),
};
})
.get(),
};
};