feat(route):add 上海市教育考试院 - 消息速递 (#8714)

Co-authored-by: jialinghui <mail@jialinghui.com>
This commit is contained in:
jialinghui
2022-01-23 02:25:17 +08:00
committed by GitHub
parent 5bd095f6b8
commit aa6349d74e
5 changed files with 70 additions and 0 deletions

View File

@@ -726,6 +726,13 @@ type 为 all 时category 参数不支持 cost 和 free
</Route>
## 上海市教育考试院
### 消息速递
官方网址:<http://www.shmeea.edu.cn>
<Route author="jialinghui" example="/shmeea" path="/shmeea" radar="1" rssbud="1"/>
## 上海证券交易所
### 上市公司信息最新公告披露

44
lib/v2/shmeea/index.js Normal file
View File

@@ -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,
};
};

View File

@@ -0,0 +1,3 @@
module.exports = {
'/': ['jialinghui'],
};

13
lib/v2/shmeea/radar.js Normal file
View File

@@ -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',
},
],
},
};

3
lib/v2/shmeea/router.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('', require('./index'));
};