diff --git a/docs/university.md b/docs/university.md index 00aea88cf..9d9923775 100644 --- a/docs/university.md +++ b/docs/university.md @@ -693,6 +693,10 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS +### 化学化工学院通知 + + + ### 艺术学院通知 diff --git a/lib/router.js b/lib/router.js index df6882aca..b7cab82c4 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2693,6 +2693,7 @@ router.get('/bityjs', require('./routes/universities/bit/bityjs')); router.get('/hnust/jwc', require('./routes/universities/hnust/jwc/index')); router.get('/hnust/computer', require('./routes/universities/hnust/computer/index')); router.get('/hnust/art', require('./routes/universities/hnust/art/index')); +router.get('/hnust/chem', require('./routes/universities/hnust/chem/index')); router.get('/hnust/graduate/:type?', require('./routes/universities/hnust/graduate/index')); // 西南交通大学 diff --git a/lib/routes/universities/hnust/chem/index.js b/lib/routes/universities/hnust/chem/index.js new file mode 100644 index 000000000..849167f60 --- /dev/null +++ b/lib/routes/universities/hnust/chem/index.js @@ -0,0 +1,34 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const base = 'http://chem.hnust.edu.cn/sytzgg/'; + const link = base + 'index.htm'; + const response = await got.get(link); + const $ = cheerio.load(response.data); + const list = $('.subNewsList li'); + + ctx.state.data = { + title: '湖南科技大学化学化工学院通知', + link: link, + description: '湖南科技大学化学化工学院通知', + image: 'https://i.loli.net/2020/03/24/EAoPzbTsBxeOdjH.jpg', + item: + list && + list + .map((index, item) => { + item = $(item); + const date = item.find('span').text(); + const title = item.find('h3').text(); + const url = base + item.find('a').attr('href'); + + return { + title: title, + description: title, + pubDate: new Date(date).toUTCString(), + link: url, + }; + }) + .get(), + }; +};