mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-13 08:39:38 +08:00
支持大连工业大学教务处新闻 (#563)
This commit is contained in:
@@ -264,6 +264,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||||||
- 全国气象预警
|
- 全国气象预警
|
||||||
- Gitlab
|
- Gitlab
|
||||||
- Explore
|
- Explore
|
||||||
|
- 大连工业大学
|
||||||
|
- 教务处新闻
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|||||||
@@ -290,6 +290,20 @@ type, 可选, 默认为 `all`
|
|||||||
| -------- | -------- | ---------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
| -------- | -------- | ---------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||||
| 实践创新 | 学科竞赛 | 研究生助教 | 教学改革 | 专业建设 | 课程建设 | 教材建设 | 教学成果 | 学术报告 |
|
| 实践创新 | 学科竞赛 | 研究生助教 | 教学改革 | 专业建设 | 课程建设 | 教材建设 | 教学成果 | 学术报告 |
|
||||||
|
|
||||||
|
### 大连工业大学
|
||||||
|
|
||||||
|
#### 教务处新闻 <Author uid="xu42"/>
|
||||||
|
|
||||||
|
举例: [https://rsshub.app/dpu/jiaowu/xwdt](https://rsshub.app/dpu/jiaowu/xwdt)
|
||||||
|
|
||||||
|
路由: `/dpu/jiaowu/:type?`
|
||||||
|
|
||||||
|
参数: type, 可选, 默认为 `xwdt`
|
||||||
|
|
||||||
|
| 新闻动态 | 通知公告 | 教务文件 |
|
||||||
|
| -------- | -------- | -------- |
|
||||||
|
| xwdt | tzgg | jwwj |
|
||||||
|
|
||||||
## 媒体类
|
## 媒体类
|
||||||
|
|
||||||
### 央视新闻
|
### 央视新闻
|
||||||
|
|||||||
@@ -467,4 +467,7 @@ router.get('/weatherAlarm', require('./routes/weatherAlarm'));
|
|||||||
// Gitlab
|
// Gitlab
|
||||||
router.get('/gitlab/explore/:type', require('./routes/gitlab/explore'));
|
router.get('/gitlab/explore/:type', require('./routes/gitlab/explore'));
|
||||||
|
|
||||||
|
// DPU
|
||||||
|
router.get('/dpu/jiaowu/:type?', require('./routes/dpu/jiaowu'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
44
routes/dpu/jiaowu.js
Normal file
44
routes/dpu/jiaowu.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
const axios = require('../../utils/axios');
|
||||||
|
const iconv = require('iconv-lite');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const resolve_url = require('url').resolve;
|
||||||
|
|
||||||
|
const base_url = 'http://jiaowu.dlpu.edu.cn';
|
||||||
|
|
||||||
|
const map = {
|
||||||
|
xwdt: '/more/2',
|
||||||
|
tzgg: '/more/3',
|
||||||
|
jwwj: '/more/4',
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const type = ctx.params.type || 'xwdt';
|
||||||
|
const link = `${base_url}${map[type]}`;
|
||||||
|
|
||||||
|
const response = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: link,
|
||||||
|
responseType: 'arraybuffer',
|
||||||
|
headers: {
|
||||||
|
Referer: base_url,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const $ = cheerio.load(iconv.decode(response.data, 'gb2312'));
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
link: link,
|
||||||
|
title: $('#more>h1').text(),
|
||||||
|
item: $('.more_list>li')
|
||||||
|
.map((_, elem) => ({
|
||||||
|
link: resolve_url(base_url, $('a', elem).attr('href')),
|
||||||
|
title: $('a', elem).text(),
|
||||||
|
pubDate: new Date(
|
||||||
|
$('a>span', elem)
|
||||||
|
.text()
|
||||||
|
.replace(/.(\d+)年(\d+)月(\d+)日./, '$1-$2-$3')
|
||||||
|
).toUTCString(),
|
||||||
|
}))
|
||||||
|
.get(),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user