mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-21 12:49:53 +08:00
fix(route): thepaper list error and change to api.thepaper.cn (#11623)
* fix thepaper list error and change to api.thepaper.cn * fix channel id in thepaper docs * fix channel id in thepaper docs * remove the trailing space in </Route>
This commit is contained in:
@@ -1694,7 +1694,6 @@ category 对应的关键词有
|
||||
|
||||
| 频道 ID | 频道名 |
|
||||
| ------ | --- |
|
||||
| 25949 | 要闻 |
|
||||
| 26916 | 视频 |
|
||||
| 108856 | 战疫 |
|
||||
| 25950 | 时事 |
|
||||
@@ -1705,9 +1704,9 @@ category 对应的关键词有
|
||||
| 119489 | 智库 |
|
||||
| 25953 | 生活 |
|
||||
| 26161 | 问吧 |
|
||||
| 122908 | 国际 |
|
||||
| -21 | 体育 |
|
||||
| -24 | 评论 |
|
||||
| -23 | 国际 |
|
||||
|
||||
</Route>
|
||||
|
||||
|
||||
@@ -5,16 +5,22 @@ const got = require('@/utils/got');
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const channel_url = `https://m.thepaper.cn/channel/${id}`;
|
||||
const response = await got(channel_url);
|
||||
const data = JSON.parse(cheerio.load(response.data)('#__NEXT_DATA__').html());
|
||||
const list = data.props.pageProps.data.list;
|
||||
const channel_url_resp = await got(channel_url);
|
||||
const channel_url_data = JSON.parse(cheerio.load(channel_url_resp.data)('#__NEXT_DATA__').html());
|
||||
|
||||
const resp = await got.post('https://api.thepaper.cn/contentapi/nodeCont/getByChannelId', {
|
||||
json: {
|
||||
channelId: id,
|
||||
},
|
||||
});
|
||||
const list = resp.data.data.list;
|
||||
|
||||
const items = await Promise.all(list.map((item) => utils.ProcessItem(item, ctx)));
|
||||
ctx.state.data = {
|
||||
title: `澎湃新闻频道 - ${utils.ChannelIdToName(id, data)}`,
|
||||
title: `澎湃新闻频道 - ${utils.ChannelIdToName(id, channel_url_data)}`,
|
||||
link: channel_url,
|
||||
item: items,
|
||||
itunes_author: '澎湃新闻',
|
||||
image: utils.ExtractLogo(response),
|
||||
image: utils.ExtractLogo(channel_url_resp),
|
||||
};
|
||||
};
|
||||
|
||||
+11
-5
@@ -5,17 +5,23 @@ const got = require('@/utils/got');
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const list_url = `https://m.thepaper.cn/list/${id}`;
|
||||
const response = await got(list_url);
|
||||
const data = JSON.parse(cheerio.load(response.data)('#__NEXT_DATA__').html());
|
||||
const pagePropsData = data.props.pageProps.data;
|
||||
const list_url_resp = await got(list_url);
|
||||
const list_url_data = JSON.parse(cheerio.load(list_url_resp.data)('#__NEXT_DATA__').html());
|
||||
|
||||
const resp = await got.post('https://api.thepaper.cn/contentapi/nodeCont/getByNodeIdPortal', {
|
||||
json: {
|
||||
nodeId: id,
|
||||
},
|
||||
});
|
||||
const pagePropsData = resp.data.data;
|
||||
const list = pagePropsData.list;
|
||||
|
||||
const items = await Promise.all(list.map((item) => utils.ProcessItem(item, ctx)));
|
||||
ctx.state.data = {
|
||||
title: `澎湃新闻栏目 - ${utils.ListIdToName(id, data)}`,
|
||||
title: `澎湃新闻栏目 - ${utils.ListIdToName(id, list_url_data)}`,
|
||||
link: list_url,
|
||||
item: items,
|
||||
itunes_author: '澎湃新闻',
|
||||
image: pagePropsData.nodeInfo?.pic ?? utils.ExtractLogo(response),
|
||||
image: pagePropsData.nodeInfo?.pic ?? utils.ExtractLogo(list_url_resp),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user