mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-14 01:00:38 +08:00
feat: add 湖北工业大学计算机学院 (#4393)
This commit is contained in:
@@ -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',
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -512,6 +512,20 @@ category 列表:
|
||||
|
||||
</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
|
||||
:::
|
||||
|
||||
## 湖南科技大学
|
||||
|
||||
### 教务处通知
|
||||
|
||||
@@ -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/cs/:type', require('./routes/universities/hbut/cs'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
41
lib/routes/universities/hbut/cs.js
Normal file
41
lib/routes/universities/hbut/cs.js
Normal 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(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user