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

如何获取视频推文的播放量?search/tweets接口无法获取该数据

获取视频推文播放量的可行方法

Hey there! Great question—this is a common pain point since the standard search/tweets endpoint (whether v1.1 or v2) doesn't return video view counts directly in search results. But there are solid workarounds using Twitter's API v2, which is the current supported version:

1. 使用Tweet Lookup端点直接获取播放量

Twitter API v2's Tweet lookup endpoint (both single and batch) exposes video view counts via the public_metrics field. When you request tweet details with the right parameters, you'll get the view_count value specifically for video/animated content.

To use this:

  • Make a GET request to https://api.twitter.com/2/tweets (for batch lookup) or https://api.twitter.com/2/tweets/{tweet_id} (for single tweets)
  • Include the query parameter tweet.fields=public_metrics
  • In the response, under each tweet's public_metrics object, you'll find view_count—this is exactly the video play count you're looking for.

Example request snippet (batch lookup):

GET /2/tweets?ids=1456789012345678901,1456789012345678902&tweet.fields=public_metrics

2. 结合搜索接口批量获取

If you need to first search for tweets (like you were doing with search/tweets) and then get their view counts, follow this workflow:

  • Use the v2 search endpoints (/2/tweets/search/recent for recent tweets, or /2/tweets/search/all for full archive access—requires academic research access) to fetch the IDs of tweets you care about.
  • Take that list of tweet IDs and pass them to the batch Tweet lookup endpoint mentioned above to retrieve the view_count for each video tweet.

Key Notes

  • API Version: Avoid relying on v1.1 endpoints for this—most v1.1 endpoints don't support view_count anymore, and Twitter is phasing out v1.1 in favor of v2.
  • Permissions: Ensure your API project has the correct access level. For example, /2/tweets/search/all requires academic research access, while /2/tweets/search/recent is available to most standard projects.
  • Field Availability: The view_count field only appears for tweets with video or animated GIF content. For regular text/image tweets, this field will be null or omitted.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 07:19:21