You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Postman/Python使用Twitter API V2获取完整扩展推文

解决Twitter API v2获取完整长推文的问题
  • 补充tweet.fields参数中的text字段
    你当前的请求里,tweet.fields仅包含created_at,attachments,lang,public_metrics,缺少text字段。在Twitter API v2中,要获取完整的长推文内容,必须显式将text加入到tweet.fields的参数列表里。修改后的tweet.fields应为:
    tweet.fields=created_at,attachments,lang,public_metrics,text

  • 修正请求URL的格式错误
    你的请求链接里有一处参数错误:&=exclude=retweets,正确写法是&exclude=retweets,多余的=会导致该参数失效,可能影响请求结果。

  • 使用修正后的完整请求URL
    调整后的完整请求链接如下:
    https://api.twitter.com/2/users/:id/tweets?max_results=100&expansions=author_id,entities.mentions.username&tweet.fields=created_at,attachments,lang,public_metrics,text&user.fields=created_at,name&exclude=retweets
    此时返回的推文数据中,text字段会直接包含完整的长推文内容,无需再使用v1.1版本的tweet_mode='extended'参数。


内容的提问来源于stack exchange,提问作者Jacob

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 09:57:21