添加 江南大学教务处通知 (#501)

This commit is contained in:
Lince 2018-08-21 23:56:34 +08:00 committed by DIYgod
parent 0f651be0f1
commit 7e40e5cc87
4 changed files with 76 additions and 0 deletions

View File

@ -246,6 +246,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
- 展览信息
- 马蜂窝
- 游记
- 江南大学
- 教务处通知
</details>

View File

@ -1973,6 +1973,26 @@ IATA 国际航空运输协会机场代码,参见[维基百科 国际航空运
type必选目前支持两种`hot` 代表热门游记,`latest` 代表最新游记
## 江南大学
### 教务处通知 <Author uid="Chingyat"/>
举例: [https://rsshub.app/ju/jwc/all](https://rsshub.app/ju/jwc/all)
路由: `/ju/jwc/:type?`
参数:
type, 可选, 默认为 `all`
| all | tzgg | ksap | wjgg | tmgz | djks | xjgl | bysj | syjs |
| ---- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| 全部 | 通知公告 | 考试安排 | 违纪公告 | 推免工作 | 等级考试 | 学籍管理 | 毕业设计 | 实验教学 |
| sjcx | xkjs | yjszj | jxgg | zyjs | kcjs | jcjs | jxcg | xsbg |
| -------- | -------- | ---------- | -------- | -------- | -------- | -------- | -------- | -------- |
| 实践创新 | 学科竞赛 | 研究生助教 | 教学改革 | 专业建设 | 课程建设 | 教材建设 | 教学成果 | 学术报告 |
## 中国地震局
### 地震速报

View File

@ -434,6 +434,9 @@ router.get('/wechat/wasi/:id', require('./routes/wechat/wasi'));
// 马蜂窝
router.get('/mafengwo/note/:type', require('./routes/mafengwo/note'));
// 江南大学
router.get('/ju/jwc/:type?', require('./routes/ju/jwc'));
// 中国地震局震情速递(与地震台网同步更新)
router.get('/earthquake', require('./routes/earthquake'));

51
routes/ju/jwc.js Normal file
View File

@ -0,0 +1,51 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const resolve_url = require('url').resolve;
const base_url = 'http://jwc.jiangnan.edu.cn';
const map = {
all: '/',
tzgg: '/jwgl/tzgg.htm',
ksap: '/jwgl/ksap.htm',
wjgg: '/jwgl/wjgg.htm',
tmgz: '/jwgl/tmgz.htm',
djks: '/jwgl/djks.htm',
xjgl: '/xjgl1.htm',
bysj: '/sjjx/bysj.htm',
syjx: '/sjjx/syjx.htm',
sjcx: '/sjjx/sjcx.htm',
xkjs: '/sjjx/xkjs.htm',
yjszj: '/sjjx/yjszj.htm',
jxgg: '/jxjs/jxgg.htm',
zyjs: '/jxjs/zyjs.htm',
kcjs: '/jxjs/kcjs.htm',
jcjs: '/jxjs/jcjs.htm',
jxcg: '/jxjs/jxcg.htm',
xsbg: '/xsbg.htm',
};
module.exports = async (ctx) => {
const type = ctx.params.type || 'all';
const link = `${base_url}${map[type]}`;
const response = await axios({
method: 'get',
url: link,
headers: {
Referer: link,
},
});
const $ = cheerio.load(response.data);
ctx.state.data = {
link: link,
title: $('title').text(),
item: $('.pg-list>ul>li').map((_, elem) => ({
link: resolve_url(link, $('a', elem).attr('href')),
title: $('a', elem).text(),
pubDate: new Date($('span.food-time', elem).text()).toUTCString(),
})),
};
};