feat: add 上海交通大学研招网招考信息 (#4064)

This commit is contained in:
Richard Chien 2020-02-25 00:14:02 +08:00 committed by GitHub
parent 14e2c3dbe6
commit f318aa3de5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 1 deletions

View File

@ -870,7 +870,7 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
### 电子信息与电气工程学院本科教务办
<Route author="Polynomia" example="/sjtu/seiee/xsb/news" path="/universities/sjtu/seiee/bjwb/:type" :paramsDesc="['无默认选项']">
<Route author="Polynomia" example="/sjtu/seiee/bjwb/major_select" path="/universities/sjtu/seiee/bjwb/:type" :paramsDesc="['无默认选项']">
| 分专业 | 转专业 | 直升研究生 | 交换交流 | 国际办学 |
| ------------ | -------------- | ------------ | -------- | ------------- |
@ -912,6 +912,16 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
<Route author="SeanChao" example="/sjtu/tongqu" path="/universities/sjtu/tongqu"/>
### 研究生招生网招考信息
<Route author="richardchien" example="/sjtu/yzb/zkxx/sszs" path="/universities/sjtu/yzb/zkxx/:type" :paramsDesc="['无默认选项']">
| 博士招生 | 硕士招生 | 港澳台招生 | 考点信息 | 院系动态 |
| -------- | -------- | ---------- | -------- | -------- |
| bszs | sszs | gatzs | kdxx | yxdt |
</Route>
## 上海科技大学
### 信息科技与技术学院活动

View File

@ -575,6 +575,7 @@ router.get('/sjtu/seiee/xsb/:type?', require('./routes/universities/sjtu/seiee/x
router.get('/sjtu/gs/tzgg/:type?', require('./routes/universities/sjtu/gs/tzgg'));
router.get('/sjtu/jwc/:type?', require('./routes/universities/sjtu/jwc'));
router.get('/sjtu/tongqu', require('./routes/universities/sjtu/tongqu/activity'));
router.get('/sjtu/yzb/zkxx/:type', require('./routes/universities/sjtu/yzb/zkxx'));
// 江南大学
router.get('/ju/jwc/:type?', require('./routes/universities/ju/jwc'));

View File

@ -0,0 +1,41 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const url = require('url');
const baseTitle = '上海交通大学研究生招生网招考信息';
const baseUrl = 'https://yzb.sjtu.edu.cn/index/zkxx/';
module.exports = async (ctx) => {
const pageUrl = `${baseUrl}${ctx.params.type}.htm`;
const response = await got({
method: 'get',
url: pageUrl,
headers: {
Referer: pageUrl,
},
});
const $ = cheerio.load(response.data);
ctx.state.data = {
link: pageUrl,
title: `${baseTitle} -- ${
$('title')
.text()
.split('-')[0]
}`,
item: $('li[id^="line"] a')
.slice(0, 10)
.map((_, elem) => ({
link: url.resolve(pageUrl, elem.attribs.href),
title: elem.attribs.title,
pubDate: new Date(
$(elem.next)
.text()
.trim()
).toUTCString(),
}))
.get(),
};
};