From b4bc6995a3ed2562de2371a66cd50682d650e12f Mon Sep 17 00:00:00 2001 From: 276562578 <276562578@163.com> Date: Tue, 28 Jul 2020 13:09:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=89=E6=9E=97=E5=A4=A7=E5=AD=A6=20?= =?UTF-8?q?=E6=A0=A1=E5=86=85=E9=80=9A=E7=9F=A5=20(#5183)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/university.md | 6 ++++++ lib/router.js | 3 +++ lib/routes/universities/jlu/oa.js | 31 +++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 lib/routes/universities/jlu/oa.js diff --git a/docs/university.md b/docs/university.md index 4b2f55ed0..492bed720 100644 --- a/docs/university.md +++ b/docs/university.md @@ -757,6 +757,12 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS +## 吉林大学 + +### 校内通知 + + + ## 江南大学 ### 教务处通知 diff --git a/lib/router.js b/lib/router.js index 406709941..c80f616b5 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2953,4 +2953,7 @@ router.get('/ngbj/cat/:cat', require('./routes/niaogebiji/cat')); // 东方我乐多丛志 router.get('/touhougarakuta/:language/:type', require('./routes/touhougarakuta')); +// 吉林大学校内通知 +router.get('/jlu/oa', require('./routes/universities/jlu/oa')); + module.exports = router; diff --git a/lib/routes/universities/jlu/oa.js b/lib/routes/universities/jlu/oa.js new file mode 100644 index 000000000..b850e0c0d --- /dev/null +++ b/lib/routes/universities/jlu/oa.js @@ -0,0 +1,31 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const response = await got({ + method: 'get', + url: 'https://oa.jlu.edu.cn/defaultroot/PortalInformation!jldxList.action', + }); + + const data = response.data; + + const $ = cheerio.load(data); // 使用 cheerio 加载返回的 HTML + const list = $('div[class="li rel"]'); + + ctx.state.data = { + title: 'jlu oa', + link: 'https://oa.jlu.edu.cn/defaultroot/PortalInformation!jldxList.action', + item: + list && + list + .map((index, item) => { + item = $(item); + return { + title: item.find('a.font14').text(), + description: item.find('a.column').text(), + link: item.find('a.font14').attr('href'), + }; + }) + .get(), + }; +};