diff --git a/docs/university.md b/docs/university.md index 9b7ddcd97..d2ab6103a 100644 --- a/docs/university.md +++ b/docs/university.md @@ -1050,6 +1050,10 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS +### 华东理工继续教育学院新闻公告 + + + ## 华东师范大学 ### 华东师范大学研究生院 diff --git a/lib/v2/ecust-jxjy/maintainer.js b/lib/v2/ecust-jxjy/maintainer.js new file mode 100644 index 000000000..34ccf59d3 --- /dev/null +++ b/lib/v2/ecust-jxjy/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/ecust-jxjy/news': ['jialinghui'], +}; diff --git a/lib/v2/ecust-jxjy/news.js b/lib/v2/ecust-jxjy/news.js new file mode 100644 index 000000000..6627b735c --- /dev/null +++ b/lib/v2/ecust-jxjy/news.js @@ -0,0 +1,47 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const timezone = require('@/utils/timezone'); +const { parseDate } = require('@/utils/parse-date'); + +const baseURL = 'https://jxjy.ecust.edu.cn/'; + +module.exports = async (ctx) => { + const url = baseURL + 'yeDaZhuanLan.aspx?pk=153'; + const response = await got({ + method: 'get', + url, + }); + + const data = response.data; + + const $ = cheerio.load(data); + + const list = $('#main .enro_content>dl'); + + const items = await Promise.all( + list.map(async (i, item) => { + item = $(item); + const link = baseURL + item.find('a').attr('href'); + const description = await ctx.cache.tryGet(link, async () => { + const result = await got.get(link); + + const $ = cheerio.load(result.data); + + return $('#articlepanel').html(); + }); + return { + title: item.find('a').text().trim(), + pubDate: timezone(parseDate(item.find('dd').text().trim(), 'YYYY/MM/DD'), +8), + link, + description, + }; + }) + ); + + ctx.state.data = { + title: '华东理工继续教育学院', + description: '新闻公告', + link: baseURL, + item: items, + }; +}; diff --git a/lib/v2/ecust-jxjy/radar.js b/lib/v2/ecust-jxjy/radar.js new file mode 100644 index 000000000..3176db1e0 --- /dev/null +++ b/lib/v2/ecust-jxjy/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'jxjy.ecust.edu.cn': { + _name: '华东理工继续教育学院', + '.': [ + { + title: '新闻公告', + docs: 'https://docs.rsshub.app/university.html#hua-dong-li-gong-ji-xu-jiao-yu-xue-yuan', + source: '/yeDaZhuanLan.aspx?pk=153', + target: '/ecust-jxjy/news', + }, + ], + }, +}; diff --git a/lib/v2/ecust-jxjy/router.js b/lib/v2/ecust-jxjy/router.js new file mode 100644 index 000000000..69a5972f6 --- /dev/null +++ b/lib/v2/ecust-jxjy/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/news', require('./news')); +};