feat: add 湖北工业大学计算机学院 (#4393)

This commit is contained in:
Lava-Swimmer
2020-04-13 19:28:04 +08:00
committed by GitHub
parent dfdde83f7c
commit 834b5dca56
4 changed files with 88 additions and 0 deletions

View File

@@ -1573,5 +1573,37 @@
}, },
}, },
], ],
jsjxy: [
{
title: '新闻动态',
docs: 'http://docs.rsshub.app/university.html#hu-bei-gong-ye-da-xue',
source: '/index/xwdt.htm',
target: '/hbut/cs/xwdt',
},
{
title: '通知公告',
docs: 'http://docs.rsshub.app/university.html#hu-bei-gong-ye-da-xue',
source: '/index/tzgg.htm',
target: '/hbut/cs/tzgg',
},
{
title: '教学信息',
docs: 'http://docs.rsshub.app/university.html#hu-bei-gong-ye-da-xue',
source: '/jxxx.htm',
target: '/hbut/cs/jxxx',
},
{
title: '科研动态',
docs: 'http://docs.rsshub.app/university.html#hu-bei-gong-ye-da-xue',
source: '/kxyj/kydt.htm',
target: '/hbut/cs/kydt',
},
{
title: '党建活动',
docs: 'http://docs.rsshub.app/university.html#hu-bei-gong-ye-da-xue',
source: '/djhd/djhd.htm',
target: '/hbut/cs/djhd',
},
],
}, },
}); });

View File

@@ -512,6 +512,20 @@ category 列表:
</Route> </Route>
### 计算机学院
<Route author="Lava-Swimmer" example="/hbut/cs/xwdt" path="/hbut/cs/:type" radar="1" :paramsDesc="['分类']">
| 新闻动态 | 通知公告 | 教学信息 | 科研动态 | 党建活动 |
| -------- | -------- | -------- | -------- | -------- |
| xwdt | tzgg | jxxx | kydt | djhd |
</Route>
::: warning 注意
jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS_REJECT_UNAUTHORIZED = 0
:::
## 湖南科技大学 ## 湖南科技大学
### 教务处通知 ### 教务处通知

View File

@@ -2509,5 +2509,6 @@ router.get('/blogs/diygod/gk', require('./routes/blogs/diygod/gk'));
// 湖北工业大学 // 湖北工业大学
router.get('/hbut/news/:type', require('./routes/universities/hbut/news')); router.get('/hbut/news/:type', require('./routes/universities/hbut/news'));
router.get('/hbut/cs/:type', require('./routes/universities/hbut/cs'));
module.exports = router; module.exports = router;

View File

@@ -0,0 +1,41 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const resolve_url = require('url').resolve;
const base_url = 'https://jsjxy.hbut.edu.cn';
const map = {
xwdt: '/index/xwdt.htm',
tzgg: '/index/tzgg.htm',
jxxx: '/jxxx.htm',
kydt: '/kxyj/kydt.htm',
djhd: '/djhd/djhd.htm',
};
module.exports = async (ctx) => {
const type = ctx.params.type;
const link = `${base_url}${map[type]}`;
const response = await got({
method: 'get',
url: link,
headers: {
Referer: link,
},
});
const $ = cheerio.load(response.data);
ctx.state.data = {
link: link,
title: $('title').text(),
item: $('dl.nesw_list>dt')
.slice(0, 10)
.map((_, elem) => ({
link: resolve_url(link, $('a', elem).attr('href')),
title: $('a', elem).text(),
pubDate: new Date(`${$('font:nth-child(3)', elem).text()}`).toString(),
}))
.get(),
};
};