diff --git a/assets/radar-rules.js b/assets/radar-rules.js index 3c35138932..e63e619c64 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -2607,4 +2607,31 @@ }, ], }, + 'cqwu.net': { + _name: '重庆文理学院', + www: [ + { + title: '通知', + docs: 'https://docs.rsshub.app/university.html#chong-qing-wen-li-xue-yuan', + source: '/:type', + target: (params) => { + if (params.type === 'channel_7721.html') + { + return '/cqwu/news/notify'; + } + }, + }, + { + title: '学术活动', + docs: 'https://docs.rsshub.app/university.html#chong-qing-wen-li-xue-yuan', + source: '/:type', + target: (params) => { + if (params.type === 'channel_7722.html') + { + return '/cqwu/news/academiceve'; + } + }, + }, + ] + }, }); diff --git a/docs/university.md b/docs/university.md index f4f33ba5ae..4d93550380 100644 --- a/docs/university.md +++ b/docs/university.md @@ -2172,6 +2172,18 @@ type 列表: +## 重庆文理学院 + +### 通知公告 + + + +| 通知公告 | 学术活动公告 | +| ------- | ----------- | +| notify | academiceve | + + + ## 重庆科技学院 ### 教务处公告 diff --git a/lib/router.js b/lib/router.js index 462adc2c40..ff58e7e071 100644 --- a/lib/router.js +++ b/lib/router.js @@ -728,6 +728,9 @@ router.get('/cqu/youth/:category', require('./routes/universities/cqu/youth/info router.get('/cqu/sci/:category', require('./routes/universities/cqu/sci/info')); router.get('/cqu/net/:category', require('./routes/universities/cqu/net/info')); +// 重庆文理学院 +router.get('/cqwu/news/:type?', require('./routes/universities/cqwu/news')); + // 南京信息工程大学 router.get('/nuist/bulletin/:category?', require('./routes/universities/nuist/bulletin')); router.get('/nuist/jwc/:category?', require('./routes/universities/nuist/jwc')); diff --git a/lib/routes/universities/cqwu/news.js b/lib/routes/universities/cqwu/news.js new file mode 100644 index 0000000000..0c0d7b7a0b --- /dev/null +++ b/lib/routes/universities/cqwu/news.js @@ -0,0 +1,40 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const url = require('url').resolve; + +const host = 'http://www.cqwu.edu.cn'; +const map = { + notify:'/channel_7721.html', + academiceve: '/channel_7722.html', +}; +const titleMap = { + notify:'通知', + academiceve:'学术活动', +}; + +module.exports = async (ctx) => { + const type = ctx.params.type || 'academiceve'; + const link = host + map[type]; + const title = '重文理' + titleMap[type] + '公告'; + const response = await got.get(link); + const $ = cheerio.load(response.data); + const list = $('ul[class="list-unstyled news-uls"]').find('li'); + ctx.state.data = { + title: title, + link: link, + item: + list && + list + .map((index, item) => { + item = $(item); + return { + title: item.find('h4').text(), + description: item.find('p').text(), + pubDate: new Date(item.find('span[class="pull-right nes-date"]').text()).toUTCString(), + link: url(host, item.find('a').attr('href')), + }; + }) + .get(), + }; +}; +