POST

接口健康状态

24h 健康值
正常
  • 健康 / 正常
  • 可用
正常

24 小时趋势

30 天趋势

账号转发的帖子:返回列表,每次一页、每页最多 20 条,条数不固定(短页不代表到底),要更多就把响应顶层的 next_page_token 作为 page_token 再调,没有 next_page_token 才是到底;limit 照收但不起作用;主要字段 id、url、text、like_count、retweet_count、reply_count。支持翻页:把响应里的 next_page_token 作为 page_token 传回拿下一页,其他参数不变,每页算一次调用。

请求发到 POST https://api.everyinfra.com/api/v1/social,platform 填 twitter,action 填 user_reposts。 单价 $0.56 / 千次(每次 $0.000556),失败和空结果都不收费。 同步返回;慢任务可在请求体加 "mode": "async",先拿 job_id 再轮询。

AI 提示词

#
请帮我用 EveryInfra 的「X (Twitter) 账号转发的帖子」接口(twitter/user_reposts)写一个数据采集脚本。

接口约定:
- 请求:POST https://api.everyinfra.com/api/v1/social,请求头 Authorization: Bearer <API Key>;Key 从环境变量 EVERYINFRA_API_KEY 读取,不要写进代码。
- 请求体里 platform 填 twitter,action 填 user_reposts,参数放在 params 里。
- 必填参数:
  - username:X 用户短名,可带 @,也可填主页链接 https://x.com/<用户名>;返回这个账号转发的帖子,按转发时间从新到旧,每页 20 条。
- 可选参数:
  - page_token:翻页令牌:把上一次响应里的 next_page_token 原样传回,拿下一页;不传从第一页开始。令牌 24 小时有效,每页算一次调用。
- 返回一组记录,每条记录的主要字段:id、url、text、like_count、retweet_count(转发数)、reply_count、view_count、posted_at、author_username、author_name、author_url、author_follower_count;一共 33 个字段,完整列表见 https://api.everyinfra.com/api/v1/social/catalog?platform=twitter。
- 示例请求体:
{
  "platform": "twitter",
  "action": "user_reposts",
  "params": {
    "username": "nasa"
  }
}
- 计费:$0.56 / 千次;失败和空结果不扣费。
- 一次要采几十上百个时,在请求体加 "mode": "async":先拿到 job_id,再轮询 GET https://api.everyinfra.com/api/v1/jobs/{job_id} 取结果。
- 返回 422 时,按错误信息里的候选参数和允许值修正;返回 429 或 503 时,按 Retry-After 等待后重试。

写代码前,先问清楚我要采哪些对象、一共多少个、需要哪些字段、结果存成什么格式,再把方案和大概花费讲给我确认。

请求参数

#
参数名位置类型必填默认值说明
Authorizationheaderstring是-Bearer 加你的 API Key。在控制台创建;不要放进网址或代码仓库。
platformbodystring是twitter平台标识,固定值。
actionbodystring是user_reposts能力标识,固定值。
usernamebody.paramsstring是-X 用户短名,可带 @,也可填主页链接 https://x.com/<用户名>;返回这个账号转发的帖子,按转发时间从新到旧,每页 20 条。
page_tokenbody.paramsstring否-翻页令牌:把上一次响应里的 next_page_token 原样传回,拿下一页;不传从第一页开始。令牌 24 小时有效,每页算一次调用。

代码示例

#
bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "twitter",
  "action": "user_reposts",
  "params": {
    "username": "nasa"
  }
}'

OpenAPI 定义 (JSON)示例从环境变量 EVERYINFRA_API_KEY 读取 Key,复制出去的代码不含你的 Key。

响应示例

#
2026年11月21日 15:22(北京时间)用上方代码示例的参数真实调用所得。results 与 count 是那次的真实返回,已隐去名字、账号、头像、主页链接、联系方式等个人信息,列表只保留前 2 条;id、billing、quota 每次调用都不同,只给结构。
json
{  "id": "req_…",  "platform": "twitter",  "action": "user_reposts",  "results": [    {      "id": "•••",      "url": "https://x.com/NASASpox/status/2123892108893295099",      "text": "Another week of exploration, partnership, and discovery at @NASA!\n\n📡 Voyager 1 reaches one light-day from Earth\n🇯🇵 @••• visits Japan and JAXA\n🧪 @••• ISS research heads home to advance medicine and future missions\n\nHere’s your NASA Minute!",      "like_count": 397,      "retweet_count": 48,      "reply_count": 16,      "view_count": 120614,      "posted_at": "2026-11-20T21:31:53+00:00",      "author_username": "N•••x",      "author_name": "N•••x",      "author_url": "https://x.com/•••",      "author_follower_count": 20752,      "quote_count": 5,      "bookmark_count": 20,      "language": "en",      "conversation_id": "2123892108893295099",      "is_reply": false,      "is_quote": false,      "is_repost": true,      "media": [        {          "type": "video",          "url": "https://pbs.twimg.com/media/HXmO91SXUAAwUEh.jpg",          "width": 1080,          "height": 1920,          "duration_sec": 100.7,          "video_url": "https://video.twimg.com/amplify_video/2123885768443674624/vid/avc1/1080x1920/XU-ESVN5knbA18fV.mp4?tag=29"        }      ],      "mentions": [        "NASA",        "N•••n",        "S•••n"      ],      "author_id": "•••",      "author_avatar_url": "https://pbs.twimg.com/•••",      "author_bio": "•••",      "author_is_verified": true,      "author_created_at": "2025-04-03T20:34:05+00:00",      "platform": "twitter",      "reposted_by": "NASA",      "reposted_at": "2026-11-20T22:32:40+00:00"    },    {      "id": "•••",      "url": "https://x.com/NASASolarSystem/status/2123830179617186024",      "text": "Millions of people fly every day, but there’s only one trip like this. 🚀\n\nSend your name nearly a billion miles to Saturn’s moon Titan with NASA’s Dragonfly mission. Boarding passes for you and your crew: https://go.nasa.gov/dragonfly-names",      "like_count": 545,      "retweet_count": 107,      "reply_count": 23,      "view_count": 121493,      "posted_at": "2026-11-20T17:25:48+00:00",      "author_username": "N•••m",      "author_name": "N•••m",      "author_url": "https://x.com/•••",      "author_follower_count": 2977774,      "quote_count": 13,      "bookmark_count": 114,      "language": "en",      "conversation_id": "2123830179617186024",      "is_reply": false,      "is_quote": false,      "is_repost": true,      "media": [        {          "type": "video",          "url": "https://pbs.twimg.com/media/HXlcSwjWQAAzLF2.png",          "width": 720,          "height": 405,          "duration_sec": 50,          "video_url": "https://video.twimg.com/amplify_video/2123830107949117440/vid/avc1/1920x1080/TEGVtCeTF12JkdXh.mp4?tag=16"        }      ],      "links": [        "https://go.nasa.gov/dragonfly-names"      ],      "author_id": "•••",      "author_avatar_url": "https://pbs.twimg.com/•••",      "author_bio": "•••",      "author_is_verified": true,      "author_created_at": "2008-06-19T03:16:46+00:00",      "platform": "twitter",      "reposted_by": "NASA",      "reposted_at": "2026-11-20T17:55:17+00:00"    }  ],  "next_page_token": …,  "pagination": { … },  "count": 20,  "billing": {    "charged": …,    "charged_usd": …,    "balance_after_usd": …,    …  },  "quota": { … }}

返回字段

#

业务数据在 results 里;下表是每条记录可能包含的字段,平台没有提供的值不会被编造。

字段含义
id该记录在原平台上的唯一标识。仅在同一平台内唯一,跨平台可能重复。
url该记录在原平台上的可访问链接。
text正文内容,已去除 HTML 标签,全文返回、不截断(个别平台的列表结果本身只有摘要,以该平台的字段说明为准)。
like_count点赞数。null 表示该平台或该接口不公开此数据,不等于 0。
retweet_count转发数。
reply_count回复数,通常用于评论的子回复。null 表示不公开。
view_count浏览/播放数。null 表示不公开,不等于 0。
posted_at发布时间,ISO 8601 格式、UTC 时区(如 2026-08-07T12:34:56+00:00)。平台只给非标准字符串时原样透传,解析前建议做容错。null 表示平台未公开。
author_username作者用户名(@handle),通常可用于拼 URL。
author_name作者昵称(显示名)。
author_url作者在原平台的主页链接。
author_follower_count作者粉丝数。null 表示不公开。
quote_count保留平台原语义
bookmark_count书签(收藏)数。
language内容语言代码(如 zh、en),由平台判定,可能不准。
conversation_id所属对话串 ID(根推文 ID),同一串的回复据此归在一起。
is_reply保留平台原语义
is_quote是否引用推文。
is_repost保留平台原语义
reply_to_id保留平台原语义
reply_to_user_id所回复用户的数字 ID。
reply_to保留平台原语义
media推文图片 / 视频:type(photo / video / animated_gif)、url(图片或视频封面)、width、height、duration_sec(视频秒数)、video_url(码率最高的 mp4)。
hashtags正文里的话题标签数组,按出现顺序;没有时不出现这个字段。
mentions正文里 @ 到的用户名。
links正文里的外链(展开后的完整网址)。
author_id作者在原平台的唯一 ID。
author_avatar_url作者头像图片链接(多数平台带签名、会过期)。
author_bio保留平台原语义
author_is_verified保留平台原语义
author_created_at保留平台原语义
platform数据来源平台标识,与请求里的 platform 一致(如 xiaohongshu、tiktok)。
reposted_by转发这条帖子的账号(用户名);这一行本身是被转发的原帖。不是转发进来的行没有这个字段。
reposted_at转发的时间。不是转发进来的行没有这个字段。

错误与计费

#
401
缺少 Key 或 Key 无效。
402
余额不足,先充值。
422
参数名或取值不对,按错误信息给的候选改;不扣费。
429
超过每分钟请求上限,按 Retry-After 等待后再试。
503
暂时无法完成,预扣的费用退回;结果未知时先核对,不要直接重发。
200 空结果
没有数据,不扣费。

错误码

Google Analytics 同意才加载 隐私