diff --git a/docs/university.md b/docs/university.md index e054ce68b6..6178d0780f 100644 --- a/docs/university.md +++ b/docs/university.md @@ -490,6 +490,12 @@ category 列表: +## 湖南科技大学 + +### 教务处通知 + + + ## 华北水利水电大学 ### 学校通知 diff --git a/lib/router.js b/lib/router.js index 270c4b12e9..2f3d884ab7 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2410,6 +2410,9 @@ router.get('/hubu/news/:type', require('./routes/universities/hubu/news')); // 大连海事大学 router.get('/dlmu/news/:type', require('./routes/universities/dlmu/news')); +// 湖南科技大学教务处 +router.get('/hnust/jwc', require('./routes/universities/hnust/jwc/index')); + // AGE动漫 router.get('/agefans/detail/:id', require('./routes/agefans/detail')); diff --git a/lib/routes/universities/hnust/jwc/index.js b/lib/routes/universities/hnust/jwc/index.js new file mode 100644 index 0000000000..681c507e10 --- /dev/null +++ b/lib/routes/universities/hnust/jwc/index.js @@ -0,0 +1,33 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const base = 'http://jwc.hnust.edu.cn/gzzd2_20170827120536008171/jwk3_20170827120536008171/'; + const link = 'http://jwc.hnust.edu.cn/gzzd2_20170827120536008171/jwk3_20170827120536008171/index.htm'; + const response = await got.get(link); + const $ = cheerio.load(response.data); + const list = $('.articleList ul li'); + + ctx.state.data = { + title: '湖南科技大学教务处通知', + link: link, + description: '湖南科技大学教务处通知', + item: + list && + list + .map((index, item) => { + item = $(item); + const date = item.find('span').text(); + const title = item.find('a').text(); + const url = base + item.find('a').attr('href'); + + return { + title: title, + description: title, + pubDate: new Date(date).toUTCString(), + link: url, + }; + }) + .get(), + }; +};