feat(route): 东华大学 教务处-通知公告 and 信息公开网-最新公开信息 (#8698)

* 东华大学教务处-通知公告

* Update doc

* Upgrade to v2 standard

* Deleted v1 standard version

* Add route /dhu/xxgk/news

* Deleted unused param type

* close <Route> tag in Line 674

* ->String(base_url)

* fix lint

* fix: replace depreciated url.resolve, use parseDate
This commit is contained in:
Ishirai
2022-02-26 23:04:08 +08:00
committed by GitHub
parent 294161b098
commit dd430d1ab9
6 changed files with 110 additions and 0 deletions
+16
View File
@@ -683,6 +683,22 @@ xskb1 对应 <http://www.auto.uestc.edu.cn/index/xskb1.htm>
</Route>
## 东华大学
### 教务处通知
<Route author="KiraKiseki" example="/dhu/jiaowu/news/student" path="/dhu/jiaowu/news/:type?" :paramsDesc="['默认为 `student`']">
| 学生专栏 | 教师专栏 |
| ------- | ------- |
| student | teacher |
</Route>
### 最新信息公开
<Route author="KiraKiseki" example="/dhu/xxgk/news" path="/dhu/xxgk/news"/>
## 东南大学
### 信息科学与工程学院学术活动
+37
View File
@@ -0,0 +1,37 @@
const got = require('@/utils/got');
const iconv = require('iconv-lite');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
const base_url = 'https://jw.dhu.edu.cn';
const map = {
student: '/tzggwxszl/list.htm',
teacher: '/tzggwjszl/list.htm',
};
module.exports = async (ctx) => {
const type = ctx.params.type;
const link = map.hasOwnProperty(type) ? `${base_url}${map[type]}` : `${base_url}/tzggwxszl/list.htm`;
const response = await got({
method: 'get',
url: link,
responseType: 'buffer',
headers: {
Referer: base_url,
},
});
const $ = cheerio.load(iconv.decode(response.data, 'utf-8'));
ctx.state.data = {
link: base_url,
title: '东华大学教务处-' + $('.col_title').text(),
item: $('.list_item')
.map((_, elem) => ({
link: new URL($('a', elem).attr('href'), base_url),
title: $('a', elem).attr('title'),
pubDate: timezone(parseDate($('.Article_PublishDate', elem).text()), +8),
}))
.get(),
};
};
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
'/jiaowu/news/:type?': ['KiraKiseki'],
'/xxgk/news': ['KiraKiseki'],
};
+17
View File
@@ -0,0 +1,17 @@
module.exports = {
'dhu.edu.cn': {
_name: '东华大学',
jw: [
{
title: '教务处通知',
docs: 'https://docs.rsshub.app/university.html#dong-hua-da-xue',
},
],
xxgk: [
{
title: '最新信息公开',
docs: 'https://docs.rsshub.app/university.html#dong-hua-da-xue',
},
],
},
};
+4
View File
@@ -0,0 +1,4 @@
module.exports = function (router) {
router.get('/jiaowu/news/:type?', require('./jiaowu/news'));
router.get('/xxgk/news', require('./xxgk/news'));
};
+32
View File
@@ -0,0 +1,32 @@
const got = require('@/utils/got');
const iconv = require('iconv-lite');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
const base_url = 'https://xxgk.dhu.edu.cn/1737/list.htm';
module.exports = async (ctx) => {
const link = base_url;
const response = await got({
method: 'get',
url: link,
responseType: 'buffer',
headers: {
Referer: base_url,
},
});
const $ = cheerio.load(iconv.decode(response.data, 'utf-8'));
ctx.state.data = {
link: base_url,
title: '东华大学信息公开网-最新公开信息',
item: $('.cols')
.map((_, elem) => ({
link: new URL($('a', elem).attr('href'), base_url),
title: $('a', elem).attr('title'),
pubDate: timezone(parseDate($('.cols_meta', elem).text()), +8),
}))
.get(),
};
};