forked from chengxuanying/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(route): add caixin yxnews 财新一线财经消息 (DIYgod#7211)
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const got = require('@/utils/got'); | ||
|
||
module.exports = async (ctx) => { | ||
const response = await got({ | ||
method: 'get', | ||
url: 'http://k.caixin.com/app/v1/list?productIdList=8,28&uid=&unit=1&name=&code=&deviceType=&device=&userTag=&p=1&c=20', | ||
headers: { | ||
Referer: `http://k.caixin.com/web/`, | ||
Host: 'k.caixin.com', | ||
}, | ||
}); | ||
|
||
const data = response.data.data.list; | ||
const items = await Promise.all( | ||
data.map(async (item) => ({ | ||
title: item.title, | ||
description: item.text, | ||
link: `http://k.caixin.com/web/detail_${item.oneline_news_code}`, | ||
pubDate: new Date(item.ts), | ||
author: '财新一线', | ||
})) | ||
); | ||
|
||
ctx.state.data = { | ||
title: `财新网 - 财新一线新闻`, | ||
link: `http://k.caixin.com/`, | ||
description: `财新网 - 财新一线新闻`, | ||
item: items, | ||
}; | ||
}; |