From b9f61420738e5263e601294e048591cfe3829c6f Mon Sep 17 00:00:00 2001 From: nyaShine <127018961+nyaShine@users.noreply.github.com> Date: Fri, 15 Sep 2023 00:04:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20/lsnu/jiaowc/tzgg=20=E4=B9=90=E5=B1=B1?= =?UTF-8?q?=E5=B8=88=E8=8C=83=E5=AD=A6=E9=99=A2=E6=95=99=E5=AD=A6=E9=83=A8?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=85=AC=E5=91=8A=20(#13268)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add /lsnu/jiaowc/tzgg 乐山师范学院教学部通知公告 * feat: /lsnu/jiaowc/tzgg/:category? 乐山师范学院教学部通知公告 * feat: /lsnu/jiaowc/tzgg 乐山师范学院教学部通知公告 * feat: /lsnu/jiaowc/tzgg 乐山师范学院教学部通知公告 * feat: /lsnu/jiaowc/tzgg 乐山师范学院教学部通知公告 * Revert "feat: /lsnu/jiaowc/tzgg 乐山师范学院教学部通知公告" This reverts commit 34c9411ef6ef3a5b92eb3f8995db5692fd12e3ec. * feat: /lsnu/jiaowc/tzgg 乐山师范学院教学部通知公告 * feat: /lsnu/jiaowc/tzgg 乐山师范学院教学部通知公告 --------- --- lib/v2/lsnu/jiaowc/tzgg.js | 52 +++++++++++++++++++++++++++++++ lib/v2/lsnu/maintainer.js | 3 ++ lib/v2/lsnu/radar.js | 13 ++++++++ lib/v2/lsnu/router.js | 3 ++ website/docs/routes/university.md | 12 +++++++ 5 files changed, 83 insertions(+) create mode 100644 lib/v2/lsnu/jiaowc/tzgg.js create mode 100644 lib/v2/lsnu/maintainer.js create mode 100644 lib/v2/lsnu/radar.js create mode 100644 lib/v2/lsnu/router.js diff --git a/lib/v2/lsnu/jiaowc/tzgg.js b/lib/v2/lsnu/jiaowc/tzgg.js new file mode 100644 index 000000000..ce0b59d00 --- /dev/null +++ b/lib/v2/lsnu/jiaowc/tzgg.js @@ -0,0 +1,52 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const category = ctx.params.category; + const url = category ? `https://jiaowc.lsnu.edu.cn/tzgg/${category}.htm` : 'https://jiaowc.lsnu.edu.cn/tzgg.htm'; + + const response = await got({ + method: 'get', + url, + }); + + const data = response.data; + + const $ = cheerio.load(data); + const list = $('tr[id^="line_u5_"]').get(); + + const out = await Promise.all( + list.map(async (item) => { + const $ = cheerio.load(item); + const title = $('a').attr('title'); + const link = `https://jiaowc.lsnu.edu.cn/${$('a').attr('href')}`; + const date = $('td[width="80"]').text(); + + const single = await ctx.cache.tryGet(link, async () => { + const response = await got({ + method: 'get', + url: link, + }); + + const articleData = response.data; + const article$ = cheerio.load(articleData); + const description = article$('.v_news_content').html(); + + return { + title, + link, + description, + pubDate: new Date(date).toUTCString(), + }; + }); + + return single; + }) + ); + + ctx.state.data = { + title: '乐山师范学院教学部通知公告', + link: 'https://jiaowc.lsnu.edu.cn/tzgg.htm', + item: out, + }; +}; diff --git a/lib/v2/lsnu/maintainer.js b/lib/v2/lsnu/maintainer.js new file mode 100644 index 000000000..42dab90d4 --- /dev/null +++ b/lib/v2/lsnu/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/jiaowc/tzgg/:category?': ['nyaShine'], +}; diff --git a/lib/v2/lsnu/radar.js b/lib/v2/lsnu/radar.js new file mode 100644 index 000000000..f028fb349 --- /dev/null +++ b/lib/v2/lsnu/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'lsnu.edu.cn': { + _name: '乐山师范学院', + '.': [ + { + title: '教学部通知公告', + docs: 'https://docs.rsshub.app/university.html#le-shan-shi-fan-xue-yuan', + source: ['/'], + target: '/lsnu/jiaowc/tzgg', + }, + ], + }, +}; diff --git a/lib/v2/lsnu/router.js b/lib/v2/lsnu/router.js new file mode 100644 index 000000000..1dbd6b562 --- /dev/null +++ b/lib/v2/lsnu/router.js @@ -0,0 +1,3 @@ +module.exports = (router) => { + router.get('/jiaowc/tzgg/:category?', require('./jiaowc/tzgg')); +}; diff --git a/website/docs/routes/university.md b/website/docs/routes/university.md index d4f2906e7..c4341e270 100644 --- a/website/docs/routes/university.md +++ b/website/docs/routes/university.md @@ -2009,6 +2009,18 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS +## 乐山师范学院 {#le-shan-shi-fan-xue-yuan} + +### 教学部通知公告 {#le-shan-shi-fan-xue-yuan-jiao-xue-bu-tong-zhi-gong-gao} + + + +| 实践教学科 | 教育运行科 | 教研教改科 | 学籍管理科 | 考试科 | 教材建设管理科 | +| -------- | -------- | -------- | -------- | -------- | -------- | +| sjjxk | jxyxk | jyjgk | xjglk | ksk | jcjsglk | + + + ## 辽宁工程技术大学 {#liao-ning-gong-cheng-ji-shu-da-xue} ### 教务公告 {#liao-ning-gong-cheng-ji-shu-da-xue-jiao-wu-gong-gao}