feat: 武汉大学计算机学院公告 (#3643)
This commit is contained in:
parent
b96830d069
commit
7d49f98405
|
|
@ -1170,3 +1170,16 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
|
|||
### 数据科学与计算机学院动态
|
||||
|
||||
<Route author="Neutrino3316 MegrezZhu" example="/sysu/sdcs" path="/sysu/sdcs" />
|
||||
|
||||
## 武汉大学
|
||||
|
||||
### 计算机学院公告
|
||||
|
||||
<Route author="SweetDumpling" example="/whu/cs/2" path="/whu/cs/:type"
|
||||
:paramsDesc="['公告类型, 详见表格']">
|
||||
|
||||
| 公告类型 | 新闻动态 | 学术讲座 | 学院通知 | 公示公告 |
|
||||
| -------- | -------- | -------- | -------- | -------- |
|
||||
| 参数 | 0 | 1 | 2 | 3 |
|
||||
|
||||
</Route>
|
||||
|
|
|
|||
|
|
@ -662,6 +662,9 @@ router.get('/kmust/jwc/:type?', require('./routes/universities/kmust/jwc'));
|
|||
router.get('/kmust/job/careers/:type?', require('./routes/universities/kmust/job/careers'));
|
||||
router.get('/kmust/job/jobfairs', require('./routes/universities/kmust/job/jobfairs'));
|
||||
|
||||
// 武汉大学
|
||||
router.get('/whu/cs/:type', require('./routes/universities/whu/cs'));
|
||||
|
||||
// 华中科技大学
|
||||
router.get('/hust/auto/notice/:type?', require('./routes/universities/hust/aia/notice'));
|
||||
router.get('/hust/auto/news/', require('./routes/universities/hust/aia/news'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
const got = require('@/utils/got');
|
||||
const date = require('@/utils/date');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const baseUrl = 'http://cs.whu.edu.cn';
|
||||
const typelist = ['新闻动态', '学术讲座', '学院通知', '公示公告'];
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = parseInt(ctx.params.type);
|
||||
const response = await got.get(baseUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
let list;
|
||||
if (type === 0) {
|
||||
list = $('ul.txt-list>li');
|
||||
} else if (type === 1) {
|
||||
list = $('div.talks-list');
|
||||
} else if (type === 2) {
|
||||
list = $('div.fl>ul.list-wrap>li');
|
||||
} else if (type === 3) {
|
||||
list = $('div.fr>ul.list-wrap>li');
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${typelist[type]} - 武汉大学计算机学院`,
|
||||
link: baseUrl,
|
||||
description: `${typelist[type]} - 武汉大学计算机学院`,
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => ({
|
||||
title: $(item)
|
||||
.find('a')
|
||||
.attr('title'),
|
||||
description: $(item)
|
||||
.find('p')
|
||||
.text()
|
||||
.trim(),
|
||||
pubDate: date(
|
||||
$(item)
|
||||
.find('span')
|
||||
.text()
|
||||
),
|
||||
link:
|
||||
baseUrl +
|
||||
$(item)
|
||||
.find('a')
|
||||
.attr('href'),
|
||||
}))
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue