mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-19 06:38:55 +08:00
feat: add pkueecs (#347)
This commit is contained in:
@@ -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 |
|
||||
|
||||
@@ -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;
|
||||
|
||||
43
routes/pku/eecs.js
Normal file
43
routes/pku/eecs.js
Normal file
@@ -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(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user