feat: add 湖南科技大学化学化工学院通知 (#5905)

This commit is contained in:
OrbitZore
2020-10-18 16:44:41 +01:00
committed by GitHub
parent 1d8357a377
commit fe05c0cbd9
3 changed files with 39 additions and 0 deletions
+4
View File
@@ -693,6 +693,10 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
<Route author="Pretty9" example="/hnust/computer" path="/hnust/computer"/>
### 化学化工学院通知
<Route author="OrbitZore" example="/hnust/chem" path="/hnust/chem"/>
### 艺术学院通知
<Route author="Pretty9" example="/hnust/art" path="/hnust/art"/>
+1
View File
@@ -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'));
// 西南交通大学
@@ -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(),
};
};