mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: add 天天基金 (#4249)
This commit is contained in:
@@ -57,3 +57,9 @@ pageClass: routes
|
||||
| announcement | news | research |
|
||||
|
||||
</Route>
|
||||
|
||||
## 天天基金
|
||||
|
||||
### 用户动态
|
||||
|
||||
<Route author="zidekuls" example="/eastmoney/user/6551094298949188" path="/eastmoney/user/:uid" :paramsDesc="['用户 id, 可在用户主页 URL 中找到']"/>
|
||||
|
||||
@@ -429,6 +429,9 @@ router.get('/xueqiu/stock_info/:id/:type?', require('./routes/xueqiu/stock_info'
|
||||
router.get('/xueqiu/snb/:id', require('./routes/xueqiu/snb'));
|
||||
router.get('/xueqiu/hots', require('./routes/xueqiu/hots'));
|
||||
|
||||
// 天天基金
|
||||
router.get('/eastmoney/user/:uid', require('./routes/eastmoney/user'));
|
||||
|
||||
// Greasy Fork
|
||||
router.get('/greasyfork/:language/:domain?', require('./routes/greasyfork/scripts'));
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
headers: {
|
||||
Accept: '*/*',
|
||||
Host: 'i.eastmoney.com',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Cache-Control': 'no-cache',
|
||||
},
|
||||
url: `https://i.eastmoney.com/api/ta/UserPostList?p=1&ps=20&uid=${uid}`,
|
||||
});
|
||||
|
||||
const data = response.data.data.re;
|
||||
const username = data[0].post_user.user_nickname;
|
||||
|
||||
ctx.state.data = {
|
||||
title: `天天基金-${username}的主页`,
|
||||
link: `https://i.eastmoney.com//${uid}`,
|
||||
description: `${username} 的 动态`,
|
||||
item: data.map((item) => ({
|
||||
title: item.post_title,
|
||||
description: item.post_content,
|
||||
pubDate: item.post_display_time,
|
||||
link: `http://guba.eastmoney.com/news,${item.code_name},${item.post_id}.html`,
|
||||
})),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user