添加河南大学教务处 (#1265)
This commit is contained in:
parent
a1e8632d1f
commit
f1d9029dda
|
|
@ -1662,6 +1662,16 @@ category 列表:
|
|||
|
||||
</route>
|
||||
|
||||
### 河南大学
|
||||
|
||||
<route name="河南大学" author="CasterWx" example="/henu/xszl" path="/henu/:type" :paramsDesc="['分类, 见下表']">
|
||||
|
||||
| 学生专栏 | 教师专栏 | 新闻公告 | 院部动态 | 高教前沿 |
|
||||
| -------- | -------- | -------- | -------- | -------- |
|
||||
| xszl | jszl | xwgg | ybdt | gjqy |
|
||||
|
||||
</route>
|
||||
|
||||
## 传统媒体
|
||||
|
||||
### 央视新闻
|
||||
|
|
|
|||
|
|
@ -654,6 +654,9 @@ router.get('/scut/jwc/:category?', require('./routes/universities/scut/jwc'));
|
|||
// 温州商学院
|
||||
router.get('/wzbc/:type?', require('./routes/universities/wzbc/news'));
|
||||
|
||||
// 河南大学
|
||||
router.get('/henu/:type?', require('./routes/universities/henu/news'));
|
||||
|
||||
// ifanr
|
||||
router.get('/ifanr/:channel?', require('./routes/ifanr/index'));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
const axios = require('../../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const resolve_url = require('url').resolve;
|
||||
|
||||
const base_url = 'http://jwc.henu.edu.cn';
|
||||
|
||||
const map = {
|
||||
all: '/',
|
||||
xszl: '/jwzl/xszl.htm',
|
||||
jszl: '/jwzl/jszl.htm',
|
||||
xwgg: '/jwzl/xwgg.htm',
|
||||
ybdt: '/jwzl/ybdt.htm',
|
||||
gjqy: '/jwzl/gjqy.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: $('.list>tr')
|
||||
.map((_, elem) => ({
|
||||
link: resolve_url(link, $('a', elem).attr('href')),
|
||||
title: $('tit1', elem).text(),
|
||||
pubDate: new Date($('time1.span', elem).text()).toUTCString(),
|
||||
}))
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue