跳转到主要内容
个性化趋势 endpoint 可为进行身份验证的用户账户提供个性化趋势数据。
注意: 只有订阅了 X Premium 的用户账户,endpoint 才会返回个性化趋势。
账户设置访问此 endpoint,需要:在我们的入门指南中了解如何获取 X API v2 endpoint 访问权限。

快速开始

身份验证

你可以使用 OAuth 1.0a 用户上下文OAuth 2.0 授权码模式配合 PKCE 对该 endpoint 进行身份验证。  

发起请求

您可以按如下方式调用 Personalized Trends endpoint: curl 'https://api.x.com/2/users/personalized_trends' --header 'Authorization: ••••••' 如果请求成功,您将看到如下所示的 JSON 响应:
{
    "data": [
        {
            "category": "比特币",
            "post_count": "4.2万条 Post",
            "trend_name": "MicroStrategy 420亿美元比特币投资",
            "trending_since": "5小时前"
        },
        {
            "category": "音乐",
            "post_count": "2千条 Post",
            "trend_name": "Drake《No Face》音乐视频发布",
            "trending_since": "正在热门"
        },
        {
            "category": "天气",
            "post_count": "1.2千条 Post",
            "trend_name": "超强台风利昂影响台湾和巴丹群岛",
            "trending_since": "正在热门"
        }
    ]
}
注意: 如果发起请求的已认证用户未订阅 X Premium,则会返回如下响应:
{
    "data": [
        {
            "category": "Unknown",
            "post_count": "Unknown",
            "trending_since": ""
        }
    ]
}
I