- Base URL:
https://x.com - GraphQL URL:
/i/api/graphql/{queryId}/{operationName} - 大多数接口需要登录 Cookie、Bearer Authorization、
x-csrf-token x-csrf-token通常等于 Cookie 中的ct0- 返回外层通常为 X 原始 JSON。测试脚本会直接输出接口返回内容:
{
"code": 0,
"message": "error message when failed",
"data": {}
}- HomeTimeline 首屏推荐时间线
- HomeTimeline 下一页
- HomeTimeline 刷新
- HomeLatestTimeline 最新时间线
- HomeLatestTimeline 下一页
- TweetDetail 推文详情
- SearchTimeline 搜索时间线
- UserByScreenName 用户信息
- UserTweets 用户推文
- Following 关注列表
- Account verify credentials 当前账号信息
- CreateTweet 发推/回复
- RepostTweet 引用转发
- FavoriteTweet 点赞
- UnfavoriteTweet 取消点赞
- Follow user 关注用户
- Unfollow user 取消关注
- Upload media 上传媒体
- Translate post 翻译推文
authorization: Bearer ...
Cookie: ...
x-csrf-token: <ct0>
x-twitter-active-user: yes
x-twitter-auth-type: OAuth2Session
x-twitter-client-language: zh-cn
User-Agent: Mozilla/5.0 ...部分接口还需要当前页面生成的 x-client-transaction-id。Python 测试脚本支持通过 X_CLIENT_TRANSACTION_ID 环境变量传入;没有该值时,部分写入或搜索接口可能被 X 拒绝。