feat(route): add dhu/yjs/news 东华大学研究生院通知 (#12831)

* add yjs-news

* add yjs news

* Update news.js

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

* feat: add radar

---------
This commit is contained in:
fox2049 2023-07-19 20:46:50 +08:00 committed by GitHub
parent beeb063dbb
commit de4b980a9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 10 deletions

View File

@ -619,7 +619,7 @@ pageClass: routes
| 博士研究生 | 硕士研究生 | 同等学力攻读硕士学位 | 港澳台地区招生 |
| :--------: | :--------: | :------------------: | :------------: |
| bsyjs | ssyjs | tdxlgdssxw | gatdqzs |
| bsyjs | ssyjs | tdxlgdssxw | gatdqzs |
</Route>
@ -1039,6 +1039,16 @@ pageClass: routes
<Route author="KiraKiseki" example="/dhu/xxgk/news" path="/dhu/xxgk/news"/>
### 研究生院通知
<Route author="fox2049" example="/dhu/yjs/news/class" path="/dhu/yjs/news/:type?" :paramsDesc="['默认为 `class`']">
| 新闻动态 | 通知公告 | 选课考试 |
| -------- | -------- | -------- |
| trend | notice | class |
</Route>
### 研究生招生信息
<Route author="fox2049" example="/dhu/yjs/zs/master" path="/dhu/yjs/zs/:type?" :paramsDesc="['默认为 `master`']">
@ -1261,7 +1271,7 @@ category 列表:
| 通知公告 | 新闻动态 | 学籍注册 | 奖助学金 | 其他 |
| :------: | :------: | :------: | :------: | :--: |
| 2981 | 2980 | 3009 | 3011 | ... |
| 2981 | 2980 | 3009 | 3011 | ... |
</Route>
@ -1293,7 +1303,7 @@ category 列表:
| 新闻 | 新闻 - 要闻 | 新闻 - 专题策划 | 其他 |
| :------: | :---------: | :-------------: | :--: |
| /card/xw | /list/xw/yw | /card/xw/ztch | ... |
| /card/xw | /list/xw/yw | /card/xw/ztch | ... |
</Route>
@ -1303,7 +1313,7 @@ category 列表:
| 新闻动态 | 通知公告 | 其他 |
| :------: | :------: | :--: |
| 3751 | 3752 | ... |
| 3751 | 3752 | ... |
</Route>
@ -2380,7 +2390,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
| 通知公告 | 本科生教务 | 研究生教务 |
| :------: | :--------: | :--------: |
| tzgg | bksjw | yjsjw |
| tzgg | bksjw | yjsjw |
</Route>
@ -2840,7 +2850,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
| 聚焦天大 | 综合新闻 | 校内新闻 | 媒体报道 | 图说天大 |
| :------: | :------: | :------: | :------: | :------: |
| focus | general | internal | media | picture |
| focus | general | internal | media | picture |
</Route>
@ -2850,7 +2860,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
| 学部新闻 | 通知公告 | 北洋智算论坛 |
| :------: | :----------: | :----------: |
| news | notification | forum |
| news | notification | forum |
</Route>
@ -2870,7 +2880,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
| 校级公告 | 统考硕士 | 统考博士 | 在职学位 |
| :------: | :------: | :------: | :------: |
| notice | master | doctor | job |
| notice | master | doctor | job |
</Route>
@ -2918,7 +2928,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
| 温大新闻 | 媒体温大 | 学术温大 | 通知公告 | 招标信息 | 学术公告 |
| :------: | :------: | :------: | :------: | :------: | :------: |
| 0 | 1 | 2 | 3 | 4 | 5 |
| 0 | 1 | 2 | 3 | 4 | 5 |
</Route>
@ -3765,7 +3775,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
| 招聘类型 | 博士后 | 课题项目聘用 | 管理支撑人才 | 教学科研人才 |
| :------: | :----: | :----------: | :----------: | :----------: |
| 参数 | bsh | ktxmpy | glzcrc | jxkyrc |
| 参数 | bsh | ktxmpy | glzcrc | jxkyrc |
</Route>

View File

@ -2,5 +2,6 @@ module.exports = {
'/jiaowu/news/:type?': ['KiraKiseki'],
'/news/xsxx': ['fox2049'],
'/xxgk/news': ['KiraKiseki'],
'/yjs/news/:type?': ['fox2049'],
'/yjs/zs/:type?': ['fox2049'],
};

View File

@ -1,6 +1,12 @@
module.exports = {
'dhu.edu.cn': {
_name: '东华大学',
gs: [
{
title: '研究生院通知',
docs: 'https://docs.rsshub.app/university.html#dong-hua-da-xue',
},
],
jw: [
{
title: '教务处通知',

View File

@ -2,5 +2,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/news/:type?', require('./yjs/news'));
router.get('/yjs/zs/:type?', require('./yjs/zs'));
};

47
lib/v2/dhu/yjs/news.js Normal file
View File

@ -0,0 +1,47 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const baseUrl = 'https://gs.dhu.edu.cn';
const map = {
trend: '/7205/list.htm',
notice: '/7206/list.htm',
class: '/xkks/list.htm',
};
module.exports = async (ctx) => {
const type = ctx.params.type || 'class';
const link = `${baseUrl}${map[type]}`;
const { data: response } = await got(link);
const $ = cheerio.load(response);
const list = $('.sub_list > li')
.toArray()
.map((item) => {
item = $(item);
const a = item.find('a').first();
return {
title: a.attr('title'),
link: a.attr('href').startsWith('http') ? a.attr('href') : `${baseUrl}${a.attr('href')}`,
pubDate: parseDate(item.find('span').text()),
};
});
// 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 = $('.wp_articlecontent').first().html();
return item;
})
)
);
ctx.state.data = {
title: '东华大学研究生-' + $('.Column_Name').text(),
link,
item: items,
};
};