feat(route): add 经济观察网 (#7610)
This commit is contained in:
parent
82749371ec
commit
29176529d7
|
|
@ -514,6 +514,92 @@ Type 栏目:
|
|||
|
||||
## 经济观察网
|
||||
|
||||
### 栏目
|
||||
|
||||
<Route author="nczitzk" example="/eeo/yaowen/dashi" path="/eeo/:column?/:category?" :paramsDesc="['栏目,见下表,默认为 商业产业', '分类,见下表,默认为该栏目下所有分类']">
|
||||
|
||||
::: tip 提示
|
||||
|
||||
以下小标题即栏目 `column`,标题下表格中为对应栏目的分类 `category`,两者需要配合使用。
|
||||
|
||||
如订阅 **时事・政策・宏观** 栏目中的 **大宗商品** 分类,填入 [`/eeo/yaowen/dzsp`](http://rsshub.app/eeo/yaowen/dzsp)。
|
||||
|
||||
若栏目下没有分类,如 **商业产业** 栏目,直接填入 [`/eeo/shangyechanye`](http://rsshub.app/eeo/shangyechanye)。
|
||||
|
||||
或者欲订阅该栏目下的所有分类,如订阅 **时事・政策・宏观** 中的所有分类,则直接将分类 `category` 留空,即 [`/eeo/yaowen`](http://rsshub.app/eeo/yaowen)。
|
||||
|
||||
:::
|
||||
|
||||
商业产业 shangyechanye [`/eeo/shangyechanye`](http://rsshub.app/eeo/shangyechanye)
|
||||
|
||||
财经 caijing [`/eeo/caijing`](http://rsshub.app/eeo/caijing)
|
||||
|
||||
上市公司 ssgsn [`/eeo/ssgsn`](http://rsshub.app/eeo/ssgsn)
|
||||
|
||||
地产 dichan [`/eeo/dichan`](http://rsshub.app/eeo/dichan)
|
||||
|
||||
汽车 qiche [`/eeo/qiche`](http://rsshub.app/eeo/qiche)
|
||||
|
||||
TMT tmt [`/eeo/tmt`](http://rsshub.app/eeo/tmt)
|
||||
|
||||
评论 pinglun [`/eeo/pinglun`](http://rsshub.app/eeo/pinglun)
|
||||
|
||||
研究院 yanjiuyuan [`/eeo/yanjiuyuan`](http://rsshub.app/eeo/yanjiuyuan)
|
||||
|
||||
::: tip 建议
|
||||
|
||||
请优先选择订阅以上栏目,下面的栏目大部分已经很久没有更新。
|
||||
|
||||
:::
|
||||
|
||||
两会 lianghui [`/eeo/lianghui`](http://rsshub.app/eeo/lianghui)
|
||||
|
||||
时事・政策・宏观 yaowen [`/eeo/yaowen`](http://rsshub.app/eeo/yaowen)
|
||||
|
||||
| 时事 | 政策 | 宏观 | 智库 | 首席观点 | 大宗商品 |
|
||||
| ----- | ------ | ------- | ---------- | -------- | -------- |
|
||||
| dashi | hfggzc | hfshuju | hfdongjian | sxgd | dzsp |
|
||||
|
||||
证券・资本・理财 jinrong [`/eeo/jinrong`](http://rsshub.app/eeo/jinrong)
|
||||
|
||||
| 债市 | 资本 | 理财 | 证券 | 银行 |
|
||||
| ------- | ----- | ----- | --------- | ----- |
|
||||
| zhaishi | ziben | licai | zhengquan | jijin |
|
||||
|
||||
| 保险 | PE / 创投 | 科创板 | 新三板 | 互联网金融 |
|
||||
| ------- | --------- | ----------- | --------- | ---------- |
|
||||
| jinkong | chuangtou | kechuangban | xinsanban | hlwjr |
|
||||
|
||||
新科技・互联网・O2O shangye [`/eeo/shangye`](http://rsshub.app/eeo/shangye)
|
||||
|
||||
| 新科技 | 互联网 | 大健康 | O2O | 花蕾之约 | 创业家笔记 | 环境 |
|
||||
| ----------- | --------- | ------ | ----- | ------------ | ---------- | -------- |
|
||||
| xinnengyuan | dianshang | yiliao | wuliu | hualeizhiyue | cyjbj | huanjing |
|
||||
|
||||
房产・汽车・消费 fcqcxf [`/eeo/fcqcxf`](http://rsshub.app/eeo/fcqcxf)
|
||||
|
||||
| 房产 | 汽车 | 消费 |
|
||||
| ------ | ----- | ------- |
|
||||
| dichan | qiche | xiaofei |
|
||||
|
||||
影视・体育・娱乐 yule [`/eeo/yule`](http://rsshub.app/eeo/yule)
|
||||
|
||||
| 娱乐 | 影视 | 体育 | 教育 |
|
||||
| ---- | ------- | ---- | ------ |
|
||||
| yule | yingshi | tiyu | jiaoyu |
|
||||
|
||||
观察家・书评・思想 gcj [`/eeo/gcj`](http://rsshub.app/eeo/gcj)
|
||||
|
||||
| 观察家 | 专栏 | 个人历史 | 书评 |
|
||||
| ---------- | -------- | -------- | ------- |
|
||||
| guanchajia | zhuanlan | lishi | shuping |
|
||||
|
||||
| 纵深 | 文化 | 领读 |
|
||||
| -------- | ------ | ------ |
|
||||
| zongshen | wenhua | lingdu |
|
||||
|
||||
</Route>
|
||||
|
||||
### 分类资讯
|
||||
|
||||
<Route author="epirus" example="/eeo/15" path="/eeo/:category" :paramsDesc="['分类']">
|
||||
|
|
|
|||
|
|
@ -1121,7 +1121,7 @@ router.get('/xiachufang/user/created/:id', require('./routes/xiachufang/user/cre
|
|||
router.get('/xiachufang/popular/:timeframe?', require('./routes/xiachufang/popular'));
|
||||
|
||||
// 经济观察报
|
||||
router.get('/eeo/:category?', require('./routes/eeo/index'));
|
||||
router.get('/eeo/:column?/:category?', require('./routes/eeo/index'));
|
||||
|
||||
// 腾讯视频
|
||||
router.get('/tencentvideo/playlist/:id', require('./routes/tencent/video/playlist'));
|
||||
|
|
|
|||
|
|
@ -1,47 +1,84 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
const legacyUrls = {
|
||||
1: '/yaowen/dashi',
|
||||
2: '/yaowen/hfggzc',
|
||||
3: '/jinrong/zhengquan',
|
||||
4: '/jinrong/ziben',
|
||||
5: '/jinrong/licai',
|
||||
6: '/shangye/xinnengyuan',
|
||||
7: '/shangye/yiliao',
|
||||
8: '/fcqcxf/dichan',
|
||||
9: '/fcqcxf/qiche',
|
||||
10: '/fcqcxf/xiaofei',
|
||||
11: '/yule/yingshi',
|
||||
12: '/yule/yule',
|
||||
13: '/yule/tiyu',
|
||||
14: '/yule/jiaoyu',
|
||||
15: '/gcj/guanchajia',
|
||||
16: '/gcj/zhuanlan',
|
||||
17: '/gcj/shuping',
|
||||
18: '/gcj/lishi',
|
||||
19: '/yaowen/hfshuju',
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category || '观察家';
|
||||
const category_url_relation = {
|
||||
'01': 'http://www.eeo.com.cn/yaowen/dashi/',
|
||||
'02': 'http://www.eeo.com.cn/yaowen/hfggzc/',
|
||||
'03': 'http://www.eeo.com.cn/jinrong/zhengquan/',
|
||||
'04': 'http://www.eeo.com.cn/jinrong/ziben/',
|
||||
'05': 'http://www.eeo.com.cn/jinrong/licai/',
|
||||
'06': 'http://www.eeo.com.cn/shangye/xinnengyuan/',
|
||||
'07': 'http://www.eeo.com.cn/shangye/yiliao/',
|
||||
'08': 'http://www.eeo.com.cn/fcqcxf/dichan/',
|
||||
'09': 'http://www.eeo.com.cn/fcqcxf/qiche/',
|
||||
10: 'http://www.eeo.com.cn/fcqcxf/xiaofei/',
|
||||
11: 'http://www.eeo.com.cn/yule/yingshi/',
|
||||
12: 'http://www.eeo.com.cn/yule/yule/',
|
||||
13: 'http://www.eeo.com.cn/yule/tiyu/',
|
||||
14: 'http://www.eeo.com.cn/yule/jiaoyu/',
|
||||
15: 'http://www.eeo.com.cn/gcj/guanchajia/',
|
||||
16: 'http://www.eeo.com.cn/gcj/zhuanlan/',
|
||||
17: 'http://www.eeo.com.cn/gcj/shuping/',
|
||||
18: 'http://www.eeo.com.cn/gcj/lishi/',
|
||||
19: 'http://www.eeo.com.cn/yaowen/hfshuju/',
|
||||
};
|
||||
const column = ctx.params.column || 'shangyechanye';
|
||||
const category = ctx.params.category || '';
|
||||
|
||||
const rootUrl = 'http://www.eeo.com.cn';
|
||||
let currentUrl = rootUrl;
|
||||
|
||||
if (parseInt(column)) {
|
||||
currentUrl += legacyUrls[parseInt(column)];
|
||||
} else {
|
||||
currentUrl += `/${column}/${category}`;
|
||||
}
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: category_url_relation[category],
|
||||
url: currentUrl,
|
||||
});
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('#lyp_article li').get();
|
||||
const result = list.map((item) => ({
|
||||
title: $(item).find('div span a').text(),
|
||||
description: $(item).find('div p').text(),
|
||||
pubDate: new Date().toUTCString(),
|
||||
link: $(item).find('>a').attr('href'),
|
||||
}));
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('#lyp_article li div span a')
|
||||
.slice(0, 15)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
link: item.attr('href'),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
content('.xd-xd-xd-rwm, .xd_zuozheinfo, .xd-lj, .xd-gg').remove();
|
||||
|
||||
item.title = content('h1').text();
|
||||
item.description = content('.xd-nr').html();
|
||||
item.pubDate = timezone(new Date(content('.thiszihao-box-add').nextUntil('.cls').find('span').eq(0).text()), +8);
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '经济观察网',
|
||||
link: 'http://www.eeo.com.cn',
|
||||
description: '经济观察网是《经济观察报》社倾力制作的全新商业资讯平台',
|
||||
item: result,
|
||||
title: $('title').text().replace('_', ' - '),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
description: '经济观察网是《经济观察报》社倾力制作的全新商业资讯平台,经济观察网冷静理智的报道风格,并糅合最新的网络技术,拥有专业的采编力量以及独家的新闻报道,为您提供及时、便捷、专业的信息服务。',
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue