diff --git a/docs/other.md b/docs/other.md index 9a4756e3d3..f65440f13f 100644 --- a/docs/other.md +++ b/docs/other.md @@ -726,6 +726,13 @@ type 为 all 时,category 参数不支持 cost 和 free +## 上海市教育考试院 + +### 消息速递 + +官方网址: + + ## 上海证券交易所 ### 上市公司信息最新公告披露 diff --git a/lib/v2/shmeea/index.js b/lib/v2/shmeea/index.js new file mode 100644 index 0000000000..14067fd34d --- /dev/null +++ b/lib/v2/shmeea/index.js @@ -0,0 +1,44 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const baseURL = 'http://www.shmeea.edu.cn'; + const rootUrl = baseURL + '/page/08000/index.html'; + const response = await got({ + method: 'get', + url: rootUrl, + }); + + const data = response.data; + + const $ = cheerio.load(data); + + const list = $('#main .pageList li'); + + 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 $('#ivs_content').html(); + }); + return { + title: item.find('a').text(), + pubDate: new Date(item.find('.listTime').text()), + link, + description, + }; + }) + ); + + ctx.state.data = { + title: '上海市教育考试院', + description: '消息速递', + link: baseURL, + item: items, + }; +}; diff --git a/lib/v2/shmeea/maintainer.js b/lib/v2/shmeea/maintainer.js new file mode 100644 index 0000000000..4e3ee73d6b --- /dev/null +++ b/lib/v2/shmeea/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/': ['jialinghui'], +}; diff --git a/lib/v2/shmeea/radar.js b/lib/v2/shmeea/radar.js new file mode 100644 index 0000000000..016d5b2d38 --- /dev/null +++ b/lib/v2/shmeea/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'shmeea.edu.cn': { + _name: '上海市教育考试院', + www: [ + { + title: '消息速递', + docs: 'https://docs.rsshub.app/other.html#shang-hai-shi-jiao-yu-kao-shi-yuan', + source: ['/'], + target: '/shmeea', + }, + ], + }, +}; diff --git a/lib/v2/shmeea/router.js b/lib/v2/shmeea/router.js new file mode 100644 index 0000000000..437937a54e --- /dev/null +++ b/lib/v2/shmeea/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('', require('./index')); +};