fix: caixin article json (#4126)
This commit is contained in:
parent
043c1e4379
commit
2c13d144b3
|
|
@ -3,16 +3,14 @@ const got = require('@/utils/got');
|
|||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'http://mapiv5.caixin.com//m/api/getWapIndexListByPage?page=1&callback=jQuery213030389065931348935_1560140003113&_=1560140003179',
|
||||
url: 'http://mapiv5.caixin.com//m/api/getWapIndexListByPage?page=1&callback=&_=1560140003179',
|
||||
headers: {
|
||||
Referer: `http://mapiv5.caixin.com/`,
|
||||
Host: 'mapiv5.caixin.com',
|
||||
},
|
||||
});
|
||||
|
||||
const reg = /(.*jQuery.*\()([\s\S]*)(\))/;
|
||||
const datatmp = response.data.replace(reg, '$2');
|
||||
const data = JSON.parse(datatmp).data.list;
|
||||
const data = response.data.data.list;
|
||||
|
||||
ctx.state.data = {
|
||||
title: `财新网 - 首页`,
|
||||
|
|
@ -20,8 +18,9 @@ module.exports = async (ctx) => {
|
|||
description: '财新网 - 首页',
|
||||
item: data.map((item) => ({
|
||||
title: item.title,
|
||||
description: item.summary,
|
||||
description: `<p>${item.summary}</p><img src="${item.pics}">`,
|
||||
link: item.web_url,
|
||||
pubDate: new Date(item.time * 1000),
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue