diff --git a/docs/README.md b/docs/README.md index 80e71924a9..1d700eaab8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1433,3 +1433,17 @@ id, 专辑 id, 可在对应专辑页面的 URL 中找到 举例: [https://rsshub.app/kejixingqiu/home](https://rsshub.app/kejixingqiu/home) 路由: `/kejixingqiu/home` + +## 北大信科 + +### 公告通知 + +举例: [https://rsshub.app/pku/eecs/0](https://rsshub.app/pku/eecs/0) + +路由: `/eecs/:type` + +可选参数: type,分区 type,可在网页 URL 中找到 + +| 全部 | 学院通知 | 人事通知 | 教务通知 | 学工通知 | 科研通知 | 财务通知 | 工会通知 | 院友通知 | +| ---- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | +| 0 | 1 | 2 | 6 | 8 | 7 | 5 | 3 | 4 | diff --git a/router.js b/router.js index 98c883a29d..1c9b4486be 100644 --- a/router.js +++ b/router.js @@ -325,6 +325,7 @@ router.get('/mihoyo/bh2/:type', require('./routes/mihoyo/bh2')); // 灵梦御所 router.get('/reimu/category/:category', require('./routes/reimu/category')); router.get('/reimu/tag/:tag', require('./routes/reimu/tag')); + // 央视新闻 router.get('/cctv/:category', require('./routes/cctv/category')); @@ -334,4 +335,7 @@ router.get('/t66y/:id', require('./routes/t66y/index')); // 科技星球 router.get('/kejixingqiu/home', require('./routes/kejixingqiu/home')); +// PKUEECS +router.get('/pku/eecs/:type?', require('./routes/pku/eecs')); + module.exports = router; diff --git a/routes/pku/eecs.js b/routes/pku/eecs.js new file mode 100644 index 0000000000..5a9a23fb2f --- /dev/null +++ b/routes/pku/eecs.js @@ -0,0 +1,43 @@ +const axios = require('../../utils/axios'); +const cheerio = require('cheerio'); +const config = require('../../config'); + +module.exports = async (ctx) => { + const host = 'http://eecs.pku.edu.cn/'; + + let type = ctx.params && ctx.params.type; + if (type === undefined) { + type = '0'; + } + + const response = await axios({ + method: 'get', + url: host + 'Survey/Notice/?Mtitle=' + type, + headers: { + 'User-Agent': config.ua, + Referer: host, + }, + }); + + const $ = cheerio.load(response.data); + const text = $('.hvr-shutter-out-vertical'); + + ctx.state.data = { + title: '', + link: host + 'Survey/Notice/?Mtitle=' + type, + description: '北大信科 公告通知', + item: + text && + text + .map((index, item) => { + item = $(item); + return { + title: item.find('p').text(), + link: host + item.attr('href'), + description: item.find('p').text(), + pubDate: item.find('em').text(), + }; + }) + .get(), + }; +};