Add some SCNU RSS support (#401)

This commit is contained in:
fengkx 2018-08-01 17:34:43 +08:00 committed by DIYgod
parent 9776151402
commit b8a75ed999
6 changed files with 145 additions and 0 deletions

View File

@ -191,6 +191,10 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
- Next 主题
- 小米
- 众筹
- 华南师范大学
- 教务处通知
- 图书馆通知
- 计算机学院竞赛通知
</details>

View File

@ -1567,3 +1567,29 @@ id, 专辑 id, 可在对应专辑页面的 URL 中找到
路由: `/mi/crowdfunding`
参数: 无
## 华南师范大学
### 教务处通知
举例: [https://rsshub.app/scnu/jw](https://rsshub.app/scnu/jw)
路由: `/scnu/jw`
参数:无
### 图书馆通知
举例: [https://rsshub.app/scnu/library](https://rsshub.app/scnu/library)
路由: `/scnu/library`
参数:无
### 计算机学院竞赛通知
举例: [https://rsshub.app/scnu/cs/match](https://rsshub.app/scnu/cs/match)
路由: `/scnu/cs/match`
参数:无

View File

@ -360,4 +360,9 @@ router.get('/hexo/next/:url', require('./routes/hexo/next'));
// 小米
router.get('/mi/crowdfunding', require('./routes/mi/crowdfunding'));
// SCNU
router.get('/scnu/jw', require('./routes/scnu/jw'));
router.get('/scnu/library', require('./routes/scnu/library'));
router.get('/scnu/cs/match', require('./routes/scnu/cs/match'));
module.exports = router;

38
routes/scnu/cs/match.js Normal file
View File

@ -0,0 +1,38 @@
const axios = require('../../../utils/axios');
const cheerio = require('cheerio');
const config = require('../../../config');
module.exports = async (ctx) => {
const res = await axios({
method: 'get',
url: 'https://cs.scnu.edu.cn/xueshenggongzuo/chengchangfazhan/kejichuangxin/',
header: {
'User-Agent': config.ua,
Referer: 'https://cs.scnu.edu.cn',
},
});
const data = res.data;
const $ = cheerio.load(data);
const list = $('.listshow').find('li');
ctx.state.data = {
title: $('title').text(),
link: 'https://cs.scnu.edu.cn/xueshenggongzuo/chengchangfazhan/kejichuangxin/',
description: '华南师范大学计算机学院 学科竞赛',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item
.find('a')
.text()
.replace(/\d{4}-\d{2}-\d{2}/, ''),
pubDate: new Date(item.find('.r').text()).toUTCString(),
link: item.find('a').attr('href'),
};
})
.get(),
};
};

37
routes/scnu/jw.js Normal file
View File

@ -0,0 +1,37 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const config = require('../../config');
module.exports = async (ctx) => {
const res = await axios({
method: 'get',
url: 'https://jw.scnu.edu.cn/ann/index.html',
header: {
'User-Agent': config.ua,
Referer: 'https://jw.scnu.edu.cn',
},
});
const data = res.data;
const $ = cheerio.load(data);
const list = $('.notice_01').find('li');
ctx.state.data = {
title: $('title')
.first()
.text(),
link: 'https://jw.scnu.edu.cn/ann/index.html',
description: '华南师范大学教务处 - 通知公告',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('a').text(),
pubDate: new Date(item.find('.time').text()).toUTCString(),
link: item.find('a').attr('href'),
};
})
.get(),
};
};

35
routes/scnu/library.js Normal file
View File

@ -0,0 +1,35 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const config = require('../../config');
module.exports = async (ctx) => {
const res = await axios({
method: 'get',
url: 'https://lib.scnu.edu.cn/news/zuixingonggao',
header: {
'User-Agent': config.ua,
Referer: 'https://lib.scnu.edu.cn',
},
});
const data = res.data;
const $ = cheerio.load(data);
const list = $('.article-list').find('li');
ctx.state.data = {
title: $('title').text(),
link: 'https://lib.scnu.edu.cn/news/zuixingonggao',
description: '华南师范大学图书馆 - 通知公告',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('a').text(),
pubDate: new Date(item.find('.clock').text()).toUTCString(),
link: item.find('a').attr('href'),
};
})
.get(),
};
};