update 财新周刊 to 财新网 (#521)

财新周刊与财新网性质有略微不同(一个是周刊一个是时事新闻),所以在举例中特将周刊列出来了~
This commit is contained in:
不蠢会死的某翠
2018-08-24 01:01:34 +08:00
committed by DIYgod
parent 71302d351e
commit 4cc68cf81c
4 changed files with 27 additions and 9 deletions

View File

@@ -123,7 +123,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
- 央视新闻 - 央视新闻
- 专题 - 专题
- 财新网 - 财新网
- 财新周刊 - 新闻分类
- Disqus - Disqus
- 评论 - 评论
- Twitter - Twitter

View File

@@ -310,13 +310,29 @@ type, 可选, 默认为 `all`
> 网站部分内容需要付费订阅RSS 仅做更新提醒,不含付费内容。 > 网站部分内容需要付费订阅RSS 仅做更新提醒,不含付费内容。
#### 财新周刊 <Author uid="idealclover"/> #### 新闻分类 <Author uid="idealclover"/>
举例: [https://rsshub.app/caixin/weekly/coverstory](https://rsshub.app/caixin/weekly/coverstory) 举例: [https://rsshub.app/caixin/finance/regulation](https://rsshub.app/caixin/finance/regulation)
路由: `/caixin/weekly/:category` 路由: `/caixin/:column/:category`
参数category分类 参数column栏目
category栏目下的子分类名
column 列表:
| 经济 | 金融 | 政经 | 环科 | 世界 | 观点网 | 文化 | 周刊 |
| ------- | ------- | ----- | ------- | ------------- | ------- | ------- | ------ |
| economy | finance | china | science | international | opinion | culture | weekly |
以金融板块为例的 category 列表:(其余 column 以类似方式寻找)
| 监管 | 银行 | 证券基金 | 信托保险 | 投资 | 创新 | 市场 |
| ---------- | ---- | -------- | --------------- | ---------- | ---------- | ------ |
| regulation | bank | stock | insurance_trust | investment | innovation | market |
财新周刊 category 列表:
| 封面报道 | 开卷 | 社论 | 时事 | 编辑寄语 | 经济 | 金融 | 商业 | 环境与科技 | 民生 | 副刊 | | 封面报道 | 开卷 | 社论 | 时事 | 编辑寄语 | 经济 | 金融 | 商业 | 环境与科技 | 民生 | 副刊 |
| ---------- | ----- | --------- | --------------- | ----------- | ------- | ------- | -------- | ---------------------- | ------- | ------ | | ---------- | ----- | --------- | --------------- | ----------- | ------- | ------- | -------- | ---------------------- | ------- | ------ |

View File

@@ -331,7 +331,7 @@ router.get('/mihoyo/bh2/:type', require('./routes/mihoyo/bh2'));
router.get('/cctv/:category', require('./routes/cctv/category')); router.get('/cctv/:category', require('./routes/cctv/category'));
// 财新 // 财新
router.get('/caixin/weekly/:category', require('./routes/caixin/weekly')); router.get('/caixin/:column/:category', require('./routes/caixin/category'));
// 草榴社区 // 草榴社区
router.get('/t66y/:id', require('./routes/t66y/index')); router.get('/t66y/:id', require('./routes/t66y/index'));

View File

@@ -3,7 +3,8 @@ const cheerio = require('cheerio');
module.exports = async (ctx) => { module.exports = async (ctx) => {
const category = ctx.params.category; const category = ctx.params.category;
const url = `http://weekly.caixin.com/${category}`; const column = ctx.params.column;
const url = `http://${column}.caixin.com/${category}`;
const response = await axios({ const response = await axios({
method: 'get', method: 'get',
@@ -14,6 +15,7 @@ module.exports = async (ctx) => {
}); });
const $ = cheerio.load(response.data); const $ = cheerio.load(response.data);
const title = $('#p1').text() + ' - ' + $('#pL').text();
const list = $('.stitXtuwen_list dl dd'); const list = $('.stitXtuwen_list dl dd');
const items = []; const items = [];
@@ -43,9 +45,9 @@ module.exports = async (ctx) => {
} }
ctx.state.data = { ctx.state.data = {
title: '财新周刊', title: title,
link: url, link: url,
description: '财新周刊 - 提供财经新闻及资讯服务', description: '财新 - 提供财经新闻及资讯服务',
item: items.map((item) => ({ item: items.map((item) => ({
title: item.title, title: item.title,
description: item.desc, description: item.desc,