diff --git a/README.md b/README.md index 6a2058ebb944a7..2fcb31a1442834 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,10 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇 - Next 主题 - 小米 - 众筹 +- 华南师范大学 + - 教务处通知 + - 图书馆通知 + - 计算机学院竞赛通知 diff --git a/docs/README.md b/docs/README.md index 43cbe535f8c9eb..8135ad0e699173 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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` + +参数:无 diff --git a/router.js b/router.js index 04a2b82035e3a2..6d9f24942835e0 100755 --- a/router.js +++ b/router.js @@ -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; diff --git a/routes/scnu/cs/match.js b/routes/scnu/cs/match.js new file mode 100644 index 00000000000000..892992f58ed90a --- /dev/null +++ b/routes/scnu/cs/match.js @@ -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(), + }; +}; diff --git a/routes/scnu/jw.js b/routes/scnu/jw.js new file mode 100644 index 00000000000000..d4d5eb36124313 --- /dev/null +++ b/routes/scnu/jw.js @@ -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(), + }; +}; diff --git a/routes/scnu/library.js b/routes/scnu/library.js new file mode 100644 index 00000000000000..976b6e48524e40 --- /dev/null +++ b/routes/scnu/library.js @@ -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(), + }; +};