X/Twitter API 文档

X/Twitter API: 个人资料 — 按用户 ID 获取热门帖子

通过已知标识符从 X/Twitter 获取详细的公开个人资料数据,用于对象记录、验证和数据补全。

当对象已知、您的产品需要其当前公开上下文时,请使用“按用户 ID 获取热门帖子”。

方法 GET
实体 个人资料
版本 2
此端点的作用

利用此 API 方法可以构建什么

先查看结果和常见工作流,然后再了解参数和可运行的请求示例。

此端点可以帮助您

响应以规范化的 V2 格式或平台原生的 V1 格式提供可用的个人资料字段。

何时使用

当对象已知、您的产品需要其当前公开上下文时,请使用“按用户 ID 获取热门帖子”。

常见使用场景

记录补全

将公开的 X/Twitter 字段附加到已知的产品对象上。

数据验证

在后续处理之前验证标识符和当前的公开上下文。

分析准备

将对象详情用作报告、评分和相关请求的输入。

可用版本

响应版本

两个版本完成相同的任务,接受相同的参数。使用切换按钮比较响应结构,并选择您的客户端所需的版本。

响应版本 V2

在本页面切换版本,即可在同一文档 URL 下比较响应结构。

保持不变的部分

V1 和 V2 的身份验证、必填参数和请求结构均相同。实际上,您只需在构建端点路径和解析响应时选择版本。

版本之间的差异

主要区别在于响应结构。新集成请使用 V2;仅在需要兼容现有客户端契约时保留 V1。

使用方法

如何调用该方法

两个版本使用相同的 API 密钥请求头和相同的查询参数。本文档先展示共享的参数集合,然后展示各版本特定的端点路径和代码片段。

输入参数

共享参数
参数 必填 类型 示例 说明
user_id 是 str 44196397 所选平台上的数字用户 ID。

各版本的请求路径

V2

复制确切的端点路径、示例 URL 和代码片段时请选择版本。上方的参数列表保持不变。

GET /api/v2/twitter.com/profile/popular-tweets-by-user-id

规范化格式

代码示例

curl --request GET \
  --url "https://www.scrapestorm.net/api/v2/twitter.com/profile/popular-tweets-by-user-id" \
  --header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
  --get --data-urlencode 'user_id=44196397'
响应示例

按版本查看真实响应

预览保留了关键字段和集合中的前几项,便于您快速浏览响应结构。切换版本会改变 JSON 格式。

响应示例

V2 响应 JSON

已验证示例

此简明 JSON 示例来自 V2 最近一次成功的验证运行。

{
  "success": true,
  "status": "ok",
  "search_context": {
    "user_id": "44196397"
  },
  "data": {
    "tweets": {
      "count": 99,
      "items": [
        {
          "url": "https://x.com/elonmusk/status/1519480761749016577",
          "tweet_id": "1519480761749016577",
          "text": "Next I’m buying Coca-Cola to put the cocaine back in",
          "hashtags": [],
          "emails": [],
          "created_at": "2022-04-28T00:56:58Z",
          "language": "en",
          "source": "Twitter for iPhone",
          "author": {
            "url": "https://x.com/elonmusk",
            "user_id": "44196397",
            "username": "elonmusk",
            "display_name": "Elon Musk",
            "description": "Starmind",
            "emails": [],
            "external_links": [],
            "location": null,
            "created_at": "2009-06-02T20:12:29Z",
            "is_verified": false,
            "is_blue_verified": true,
            "is_protected": false,
            "possibly_sensitive": false,
            "default_profile": false,
            "default_profile_image": false,
            "followers_count": 240944565,
            "following_count": 1370,
            "tweet_count": 105744,
            "media_count": 4625,
            "listed_count": 170041,
            "like_count": 239681,
            "professional_type": "Creator",
            "professional_category_name": null,
            "affiliated_account": {
              "label": "X",
              "url": "https://x.com/X",
              "badge_url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_bigger.jpg",
              "label_type": "BusinessLabel"
            },
            "_more_fields": "5 more fields"
          },
          "is_from_automated_account": null,
          "media": {
            "images": [],
            "videos": [],
            "gifs": []
          },
          "external_links": [],
          "user_mentions": [],
          "is_reply": false,
          "reply": null,
          "is_quote": false,
          "quote_tweet_id": null,
          "is_retweet": false,
          "retweeted_tweet_id": null,
          "reply_count": 168225,
          "retweet_count": 580871,
          "quote_count": 168145,
          "like_count": 4217586,
          "bookmark_count": 22579,
          "_more_fields": "3 more fields"
        },
        {
          "url": "https://x.com/elonmusk/status/1812258574049157405",
          "tweet_id": "1812258574049157405",
          "text": "https://t.co/6eOgN9UdOy",
          "hashtags": [],
          "emails": [],
          "created_at": "2024-07-13T22:51:28Z",
          "language": "zxx",
          "source": "Twitter for iPhone",
          "author": {
            "url": "https://x.com/elonmusk",
            "user_id": "44196397",
            "username": "elonmusk",
            "display_name": "Elon Musk",
            "description": "Starmind",
            "emails": [],
            "external_links": [],
            "location": null,
            "created_at": "2009-06-02T20:12:29Z",
            "is_verified": false,
            "is_blue_verified": true,
            "is_protected": false,
            "possibly_sensitive": false,
            "default_profile": false,
            "default_profile_image": false,
            "followers_count": 240944565,
            "following_count": 1370,
            "tweet_count": 105744,
            "media_count": 4625,
            "listed_count": 170041,
            "like_count": 239681,
            "professional_type": "Creator",
            "professional_category_name": null,
            "affiliated_account": {
              "label": "X",
              "url": "https://x.com/X",
              "badge_url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_bigger.jpg",
              "label_type": "BusinessLabel"
            },
            "_more_fields": "5 more fields"
          },
          "is_from_automated_account": null,
          "media": {
            "images": [
              "…"
            ],
            "videos": [],
            "gifs": []
          },
          "external_links": [],
          "user_mentions": [],
          "is_reply": false,
          "reply": null,
          "is_quote": false,
          "quote_tweet_id": null,
          "is_retweet": false,
          "retweeted_tweet_id": null,
          "reply_count": 69185,
          "retweet_count": 374087,
          "quote_count": 40417,
          "like_count": 3192269,
          "bookmark_count": 87521,
          "_more_fields": "3 more fields"
        },
        {
          "_more_items": 97
        }
      ]
    }
  }
}
下一步

继续评估

将本文档作为第一个决策点,然后在将端点接入常规使用之前,继续了解价格、平台覆盖范围和集成规则。

打开 X/Twitter 平台页面

在实现之前,比较相邻的实体、API 方法分组和相关文档。

打开平台页面

比较 API 方法价格

在扩大使用规模之前,查看此 API 方法在公开价格表中的位置。

查看价格

查看集成规则

通过入门文档确认身份验证、版本管理、重试以及模拟环境与正式环境的差异。

打开文档
常见问题

团队在实现前常问的问题

借助这些解答,判断此 API 方法是否适合您的工作流、版本选择和上线计划。

此 X/Twitter API 方法返回哪些数据?

该方法针对个人资料执行“按用户 ID 获取热门帖子”操作。下方的简明响应示例展示了确切的字段结构。

应该选择 V1 还是 V2?

新集成请选择 V2,因为它提供规范化的结构。仅在兼容已使用平台原生格式的客户端时使用 V1。

第一个请求需要准备什么?

创建 API 密钥,在请求头中发送它,并提供表格中的必填参数。代码示例中已包含正确的路径和请求结构。