feat: add jin10.com (#6008)

close #5778
This commit is contained in:
Laam Pui 2020-10-30 17:29:29 +08:00 committed by GitHub
parent 193ef153ea
commit aed981c4ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 0 deletions

View File

@ -62,6 +62,9 @@ pageClass: routes
<Route author="nczitzk" example="/gelonghui/keyword/ 早报" path="/gelonghui/keyword/:keyword" :paramsDesc="[' 搜索关键字']/>
## 金十数据
<Route author="laampui" example="/jinshi/index" path="/jinshi/index" />
## 世界经济论坛
### 报告

View File

@ -1868,6 +1868,9 @@ router.get('/im2maker/:channel?', require('./routes/im2maker/index'));
// 巨潮资讯
router.get('/cninfo/announcement/:column/:code/:orgId/:category?', require('./routes/cninfo/announcement'));
// 金十数据
router.get('/jinshi/index', require('./routes/jinshi/index'));
// 中央纪委国家监委网站
router.get('/ccdi/scdc', require('./routes/ccdi/scdc'));

View File

@ -0,0 +1,31 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got.get('https://www.jin10.com/');
const $ = cheerio.load(response.data);
const item = [];
let month_day;
$('#jin_flash_list .jin-flash-item-container').each((index, ele) => {
const year = new Date().getFullYear();
const new_month_day = $('.jin-flash-date-line span', ele).text().trim();
new_month_day && (month_day = new_month_day);
const month = month_day.match(/\d+/g)[0];
const day = month_day.match(/\d+/g)[1];
const time = $('.item-time', ele).text();
const date = new Date(`${year}-${month}-${day} ${time}`);
item.push({
title: $('.right-content div:first-of-type', ele).text(),
link: $('.right-content .flash-item-share_right a', ele).attr('href'),
description: `${year}-${month}-${day} ${time}`,
pubDate: date.toUTCString(),
});
});
ctx.state.data = {
title: '金十数据',
link: 'https://www.jin10.com/',
item: item,
};
};