Add CQUT news (#6700)

* add CQUT news

* add CQUT libnews
This commit is contained in:
Colin-XKL
2021-01-14 21:40:27 -05:00
committed by GitHub
parent 5df4050a8c
commit acb07f82b2
5 changed files with 94 additions and 0 deletions
+17
View File
@@ -2590,4 +2590,21 @@
},
],
},
'cqut.edu.cn': {
_name: '重庆理工大学',
tz: [
{
title: '通知',
docs: 'https://docs.rsshub.app/university.html#chong-qing-li-gong-da-xue',
source: '/*',
},
],
lib: [
{
title: '图书馆通知',
docs: 'https://docs.rsshub.app/university.html#chong-qing-li-gong-da-xue',
source: '/*',
},
],
},
});
+10
View File
@@ -2194,6 +2194,16 @@ type 列表:
</Route>
## 重庆理工大学
### 学校通知
<Route author="Colin-XKL" example="/cqut/news" path="/cqut/news" radar="1"/>
### 图书馆通知
<Route author="Colin-XKL" example="/cqut/libnews" path="/cqut/libnews" radar="1"/>
## 中山大学
### 数据科学与计算机学院动态
+4
View File
@@ -3878,4 +3878,8 @@ router.get('/newzmz/:category?', require('./routes/newzmz/index'));
// Phrack Magazine
router.get('/phrack', require('./routes/phrack/index'));
// CQUT News
router.get('/cqut/news', require('./routes/universities/cqut/cqut-news'));
router.get('/cqut/libnews', require('./routes/universities/cqut/cqut-libnews'));
module.exports = router;
@@ -0,0 +1,32 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://libnews.cqut.edu.cn/',
});
const data = response.data;
const $ = cheerio.load(data); // 使用 cheerio 加载返回的 HTML
const list = $('#infoList').find('div');
ctx.state.data = {
title: '重庆理工大学中山图书馆资讯',
link: 'https://libnews.cqut.edu.cn',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('a').text().trim(),
description: item.find('a').text().trim(),
link: item.find('a').attr('href'),
pubDate: new Date(item.find('span').text().trim().slice(1, -1)).toUTCString(),
};
})
.get(),
};
};
+31
View File
@@ -0,0 +1,31 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://tz.cqut.edu.cn/',
});
const data = response.data;
const $ = cheerio.load(data); // 使用 cheerio 加载返回的 HTML
const list = $('#container').find('.record');
ctx.state.data = {
title: 'CQUT',
link: 'https://tz.cqut.edu.cn/',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('a').attr('title'),
description: item.find('a').attr('title'),
link: item.find('a').attr('href'),
pubDate: new Date(item.find('.date').text().trim()).toUTCString(),
};
})
.get(),
};
};