add feed source CCTV (央视新闻) (#152)
This commit is contained in:
@@ -86,6 +86,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
||||
- 独家号
|
||||
- 极客时间
|
||||
- 专栏文章
|
||||
- 央视新闻
|
||||
- 专题
|
||||
- Disqus
|
||||
- 评论
|
||||
- Twitter
|
||||
|
||||
@@ -651,6 +651,20 @@ key: 产品密钥
|
||||
|
||||
参数: cid,专栏 id,可从[全部专栏](https://time.geekbang.org/paid-content)进入专栏介绍页,在 URL 中找到
|
||||
|
||||
## 央视新闻
|
||||
|
||||
### 专题
|
||||
|
||||
举例: [https://rsshub.app/cctv/world](https://rsshub.app/cctv/world)
|
||||
|
||||
路由: `/cctv/:category`
|
||||
|
||||
参数:category,分类名
|
||||
|
||||
| 国内 | 国际 | 视频 | 科技 | 社会 | 法律 | 娱乐 |
|
||||
| ----- | ----- | ----- | ---- | ------- | ---- | ---- |
|
||||
| china | world | video | tech | society | law | ent |
|
||||
|
||||
## Disqus
|
||||
|
||||
### 评论
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
const axios = require('axios');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category;
|
||||
const url = `http://news.cctv.com/${category}/data/index.json`
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
'Referer': url,
|
||||
}
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
const list = data.rollData;
|
||||
const article_item = [];
|
||||
|
||||
ctx.state.data = {
|
||||
title: `央视新闻 ${category}`,
|
||||
link: `http://news.cctv.com/${category}`,
|
||||
description: `央视新闻 ${category}`,
|
||||
item: list.map((item) => ({
|
||||
title: item.title,
|
||||
description: item.description,
|
||||
link: item.url,
|
||||
pubDate: new Date(item.dateTime).toUTCString()
|
||||
})),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user