From 1feddfa37c48bcdf80ce710cfa82f8b790a1967d Mon Sep 17 00:00:00 2001 From: ikvarxt Date: Sun, 19 Apr 2020 15:21:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E8=BE=BD=E5=AE=81?= =?UTF-8?q?=E5=B7=A5=E7=A8=8B=E6=8A=80=E6=9C=AF=E5=A4=A7=E5=AD=A6=E6=95=99?= =?UTF-8?q?=E5=8A=A1=E5=85=AC=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/university.md | 10 ++++++++++ lib/router.js | 3 +++ lib/routes/universities/lntu/jwnews.js | 26 ++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 lib/routes/universities/lntu/jwnews.js diff --git a/docs/university.md b/docs/university.md index 0dba433c1..e058f0541 100644 --- a/docs/university.md +++ b/docs/university.md @@ -664,6 +664,10 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS +## 教务公告 + + + ## 井冈山大学 ### 教务处通知 @@ -696,6 +700,12 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS +## 辽宁工程技术大学 + +### 教务公告 + + + ## 洛阳理工学院 ### 教务处 diff --git a/lib/router.js b/lib/router.js index a86a28a35..02069acbc 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2539,4 +2539,7 @@ router.get('/girlimg/album/:tag?/:mode?', require('./routes/girlimg/album')); // etoland router.get('/etoland/:bo_table', require('./routes/etoland/board')); +// 辽宁工程技术大学教务在线公告 +router.get('/lntu/jwnews', require('./routes/universities/lntu/jwnews')); + module.exports = router; diff --git a/lib/routes/universities/lntu/jwnews.js b/lib/routes/universities/lntu/jwnews.js new file mode 100644 index 000000000..fd7af28b2 --- /dev/null +++ b/lib/routes/universities/lntu/jwnews.js @@ -0,0 +1,26 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const link = 'http://jwzx.lntu.edu.cn/index/jwgg.htm'; + const response = await got.get(link); + const $ = cheerio.load(response.data); + const list = $('.tr-ri li').slice(0, 10); + + ctx.state.data = { + title: '辽宁工程技术大学教务公告', + link: link, + description: '辽宁工程技术大学教务公告', + item: + list && + list + .map((index, item) => { + item = $(item); + return { + title: item.find('li a').text(), + link: item.find('li a').attr('href'), + }; + }) + .get(), + }; +};