parent
0d7f42e483
commit
cf6dff4305
|
|
@ -2318,6 +2318,12 @@ others = 热点新闻 + 滚动新闻
|
|||
|
||||
<Route author="Jeason0228" example="/guancha/personalpage/243983" path="/guancha/personalpage/:uid" :paramsDesc="['用户id, 可在URL中找到']" />
|
||||
|
||||
## 观点网
|
||||
|
||||
### 资讯
|
||||
|
||||
<Route author="drgnchan" example="/guandian/finance" path="/guandian/:category" :paramsDesc="['资讯分类,可在URL中找到']" radar="1"/>
|
||||
|
||||
## 观海新闻
|
||||
|
||||
### 首页
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
const baseUrl = 'https://www.guandian.cn';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const cat = ctx.params.category;
|
||||
const reqUrl = `${baseUrl}/${cat}/`;
|
||||
const response = await got(reqUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const items = $('.con_l li')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
const a = item.find('.con_l_con_r a');
|
||||
const link = a.attr('href');
|
||||
const title = a.find('h3').text();
|
||||
const desc = item.find('.con_l_con_r p').text();
|
||||
|
||||
const dateStr = item.find('#keyword span').text();
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
description: desc,
|
||||
pubDate: timezone(parseDate(dateStr), 8),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('head title').text(),
|
||||
link: reqUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/:category': ['drgnchan'],
|
||||
};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
'guandian.cn': {
|
||||
_name: '观点网',
|
||||
www: {
|
||||
title: '资讯',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#guan-dian-wang-zi-xun',
|
||||
source: ['/:category'],
|
||||
target: '/guandian/:category',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/:category', require('./index'));
|
||||
};
|
||||
Loading…
Reference in New Issue