feat(router): add 东华大学学术信息 (#12791)

* 增加学术信息

* 代码优化

* 测试性提交

* POST API

* POST API

* Update lib/v2/dhu/news/xsxx.js

* Update lib/v2/dhu/radar.js

---------
This commit is contained in:
fox2049
2023-07-14 23:32:41 +08:00
committed by GitHub
parent 5e63059947
commit 90f551098e
5 changed files with 66 additions and 10 deletions
+14 -10
View File
@@ -619,7 +619,7 @@ pageClass: routes
| 博士研究生 | 硕士研究生 | 同等学力攻读硕士学位 | 港澳台地区招生 |
| :--------: | :--------: | :------------------: | :------------: |
| bsyjs | ssyjs | tdxlgdssxw | gatdqzs |
| bsyjs | ssyjs | tdxlgdssxw | gatdqzs |
</Route>
@@ -1049,6 +1049,10 @@ pageClass: routes
</Route>
### 学术信息
<Route author="fox2049" example="/dhu/news/xsxx" path="/dhu/news/xsxx"/>
## 东南大学
### 信息科学与工程学院学术活动
@@ -1257,7 +1261,7 @@ category 列表:
| 通知公告 | 新闻动态 | 学籍注册 | 奖助学金 | 其他 |
| :------: | :------: | :------: | :------: | :--: |
| 2981 | 2980 | 3009 | 3011 | ... |
| 2981 | 2980 | 3009 | 3011 | ... |
</Route>
@@ -1289,7 +1293,7 @@ category 列表:
| 新闻 | 新闻 - 要闻 | 新闻 - 专题策划 | 其他 |
| :------: | :---------: | :-------------: | :--: |
| /card/xw | /list/xw/yw | /card/xw/ztch | ... |
| /card/xw | /list/xw/yw | /card/xw/ztch | ... |
</Route>
@@ -1299,7 +1303,7 @@ category 列表:
| 新闻动态 | 通知公告 | 其他 |
| :------: | :------: | :--: |
| 3751 | 3752 | ... |
| 3751 | 3752 | ... |
</Route>
@@ -2376,7 +2380,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
| 通知公告 | 本科生教务 | 研究生教务 |
| :------: | :--------: | :--------: |
| tzgg | bksjw | yjsjw |
| tzgg | bksjw | yjsjw |
</Route>
@@ -2836,7 +2840,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
| 聚焦天大 | 综合新闻 | 校内新闻 | 媒体报道 | 图说天大 |
| :------: | :------: | :------: | :------: | :------: |
| focus | general | internal | media | picture |
| focus | general | internal | media | picture |
</Route>
@@ -2846,7 +2850,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
| 学部新闻 | 通知公告 | 北洋智算论坛 |
| :------: | :----------: | :----------: |
| news | notification | forum |
| news | notification | forum |
</Route>
@@ -2866,7 +2870,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
| 校级公告 | 统考硕士 | 统考博士 | 在职学位 |
| :------: | :------: | :------: | :------: |
| notice | master | doctor | job |
| notice | master | doctor | job |
</Route>
@@ -2914,7 +2918,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
| 温大新闻 | 媒体温大 | 学术温大 | 通知公告 | 招标信息 | 学术公告 |
| :------: | :------: | :------: | :------: | :------: | :------: |
| 0 | 1 | 2 | 3 | 4 | 5 |
| 0 | 1 | 2 | 3 | 4 | 5 |
</Route>
@@ -3761,7 +3765,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
| 招聘类型 | 博士后 | 课题项目聘用 | 管理支撑人才 | 教学科研人才 |
| :------: | :----: | :----------: | :----------: | :----------: |
| 参数 | bsh | ktxmpy | glzcrc | jxkyrc |
| 参数 | bsh | ktxmpy | glzcrc | jxkyrc |
</Route>
+1
View File
@@ -1,5 +1,6 @@
module.exports = {
'/jiaowu/news/:type?': ['KiraKiseki'],
'/news/xsxx': ['fox2049'],
'/xxgk/news': ['KiraKiseki'],
'/yjs/zs/:type?': ['fox2049'],
};
+42
View File
@@ -0,0 +1,42 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const baseUrl = 'https://news.dhu.edu.cn/_wp3services/generalQuery?queryObj=articles&siteId=14&columnId=6410&pageIndex=1&rows=20';
module.exports = async (ctx) => {
const { data } = await got(baseUrl, {
headers: {
Referer: 'https://news.dhu.edu.cn/6410/',
},
});
// 从 API 响应中提取相关数据
const list = data.data.map((item) => ({
// 文章标题
title: item.title,
// 文章链接
link: item.wapUrl,
// 文章发布日期
pubDate: parseDate(item.publishTime),
// 文章作者
author: item.publisher,
}));
// item content
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const { data: response } = await got(item.link);
const $ = cheerio.load(response);
item.description = $('.new_zwCot').first().html();
return item;
})
)
);
ctx.state.data = {
title: '学术信息',
link: 'https://news.dhu.edu.cn/6410',
item: items,
};
};
+8
View File
@@ -7,6 +7,14 @@ module.exports = {
docs: 'https://docs.rsshub.app/university.html#dong-hua-da-xue',
},
],
news: [
{
title: '学术信息',
docs: 'https://docs.rsshub.app/university.html#dong-hua-da-xue',
source: ['/6410'],
target: '/dhu/news/xsxx',
},
],
xxgk: [
{
title: '最新信息公开',
+1
View File
@@ -1,5 +1,6 @@
module.exports = function (router) {
router.get('/jiaowu/news/:type?', require('./jiaowu/news'));
router.get('/news/xsxx', require('./news/xsxx'));
router.get('/xxgk/news', require('./xxgk/news'));
router.get('/yjs/zs/:type?', require('./yjs/zs'));
};