diff --git a/docs/university.md b/docs/university.md index 9df28b988..56125a943 100644 --- a/docs/university.md +++ b/docs/university.md @@ -1011,6 +1011,16 @@ pageClass: routes +### 研究生招生信息 + + + +| 博士招生 | 硕士招生 | +| -------- | -------- | +| doctor | master | + + + ## 东南大学 ### 信息科学与工程学院学术活动 diff --git a/lib/v2/dhu/maintainer.js b/lib/v2/dhu/maintainer.js index 4993d1b37..28fd3315c 100644 --- a/lib/v2/dhu/maintainer.js +++ b/lib/v2/dhu/maintainer.js @@ -1,4 +1,5 @@ module.exports = { '/jiaowu/news/:type?': ['KiraKiseki'], '/xxgk/news': ['KiraKiseki'], + '/yjs/zs/:type?': ['fox2049'], }; diff --git a/lib/v2/dhu/radar.js b/lib/v2/dhu/radar.js index a99cdd9cc..e91e94183 100644 --- a/lib/v2/dhu/radar.js +++ b/lib/v2/dhu/radar.js @@ -13,5 +13,11 @@ module.exports = { docs: 'https://docs.rsshub.app/university.html#dong-hua-da-xue', }, ], + yjs: [ + { + title: '研究生信息', + docs: 'https://docs.rsshub.app/university.html#dong-hua-da-xue', + }, + ], }, }; diff --git a/lib/v2/dhu/router.js b/lib/v2/dhu/router.js index 11dfa6b54..2f13d9e85 100644 --- a/lib/v2/dhu/router.js +++ b/lib/v2/dhu/router.js @@ -1,4 +1,5 @@ module.exports = function (router) { router.get('/jiaowu/news/:type?', require('./jiaowu/news')); router.get('/xxgk/news', require('./xxgk/news')); + router.get('/yjs/zs/:type?', require('./yjs/zs')); }; diff --git a/lib/v2/dhu/yjs/zs.js b/lib/v2/dhu/yjs/zs.js new file mode 100644 index 000000000..cb747a744 --- /dev/null +++ b/lib/v2/dhu/yjs/zs.js @@ -0,0 +1,32 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); +const timeZone = require('@/utils/timezone'); + +const baseUrl = 'https://yjszs.dhu.edu.cn'; + +const map = { + doctor: '/7126/list.htm', + master: '/7128/list.htm', +}; +module.exports = async (ctx) => { + const type = ctx.params.type || 'master'; + const link = `${baseUrl}${map[type]}`; + const { data: response } = await got(link); + + const $ = cheerio.load(response); + + const items = $('.list_item') + .map((_, elem) => ({ + link: new URL($('a', elem).attr('href'), baseUrl).href, + title: $('a', elem).attr('title'), + pubDate: timeZone(parseDate($('.Article_PublishDate', elem).text()), +8), + })) + .get(); + + ctx.state.data = { + title: '东华大学研究生-' + $('.col_title').text(), + link, + item: items, + }; +};