路由添加 金融:有知有行 (#8705)
This commit is contained in:
@@ -261,6 +261,13 @@ pageClass: routes
|
||||
|
||||
<Route author="zytomorrow" example="/xueqiu/stock_comments/SZ002626" path="/xueqiu/stock_comments/:id/:titleLength?" :paramsDesc="['股票代码(需要带上交易所)', '标题长度']"/>
|
||||
|
||||
## 有知有行
|
||||
|
||||
### 有知文章
|
||||
|
||||
<Route author="broven" example="/youzhiyouxing/materials" path="/youzhiyouxing/materials" />
|
||||
|
||||
|
||||
## 证券时报网
|
||||
|
||||
### 要闻
|
||||
|
||||
@@ -2129,6 +2129,8 @@ router.get('/weidian/goods/:id', lazyloadRouteHandler('./routes/weidian/goods'))
|
||||
|
||||
// 有赞
|
||||
router.get('/youzan/goods/:id', lazyloadRouteHandler('./routes/youzan/goods'));
|
||||
// 有知有行
|
||||
router.get('/youzhiyouxing/materials', lazyloadRouteHandler('./routes/youzhiyouxing/materials'));
|
||||
// 币世界快讯
|
||||
router.get('/bishijie/kuaixun', lazyloadRouteHandler('./routes/bishijie/kuaixun'));
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `https://youzhiyouxing.cn/materials`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('[phx-click=material]');
|
||||
const resData = {
|
||||
title: '有知有行 - 有知',
|
||||
link,
|
||||
description: '有知有行 - 有知',
|
||||
item: list
|
||||
.map((_index, item) => {
|
||||
const $item = $(item);
|
||||
const res = {
|
||||
title: $item.find('.title-bar > h3').text(),
|
||||
description: $item.find('.sm-text').text(),
|
||||
link: `https://youzhiyouxing.cn/materials/${$item.attr('phx-value-id')}`,
|
||||
};
|
||||
return res;
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
ctx.state.data = resData;
|
||||
};
|
||||
Reference in New Issue
Block a user