mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
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:
@@ -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"/>
|
||||
|
||||
## 东南大学
|
||||
|
||||
### 信息科学与工程学院学术活动
|
||||
|
||||
@@ -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(),
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
'/jiaowu/news/:type?': ['KiraKiseki'],
|
||||
'/xxgk/news': ['KiraKiseki'],
|
||||
};
|
||||
@@ -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',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/jiaowu/news/:type?', require('./jiaowu/news'));
|
||||
router.get('/xxgk/news', require('./xxgk/news'));
|
||||
};
|
||||
@@ -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(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user