计算推文/计数/最近和推文/搜索/最近的差异

发布于 2025-01-27 12:20:01 字数 1528 浏览 3 评论 0原文

我正在使用API​​V2从Twitter获取推文。

为了保持数据的可信度,我首先使用 https://api.twitter.com/ 2/Tweets/counts/最近的获取特定查询的推文计数。 稍后,我使用相同的参数/查询在相同的持续时间内使用 htttps:htttps:// api.twitter.com/2/tweets/search/recent 但是,在获取推文的同时,我的数量要比计数API的数量要少。

示例:

query parameters for count:
query_params_counts = {"query": "keyword -is:retweet  lang:en",
              "granularity":"day",
              "start_time":"2022-05-09T00:00:00.000Z",
              "end_time":"2022-05-010T00:00:00.000Z"
              } 

for this count is coming: 1766


query_params_tweets = {"query":"keyword -is:retweet  lang:en",
            "start_time":"2022-05-09T00:00:00.000Z",
            "end_time": "2022-05-010T00:00:00.000Z",
            "max_results": 100,
            "expansions": "author_id,attachments.media_keys,entities.mentions.username",
            "tweet.fields": "id,text,created_at,attachments,public_metrics",
            "user.fields": "id,name,username,created_at,description,profile_image_url,location,public_metrics,url",
            "place.fields": "full_name,id,country,country_code,geo,name,place_type",
            "media.fields": "media_key,type,url",
            "next_token": {}
            }

for this count is: 1751

我尝试多次运行,但结果保持不变。 有人可以帮我理解这是什么原因吗?

I am fetching tweets from twitter using APIv2.

To maintain the credibility of data first I am using https://api.twitter.com/2/tweets/counts/recent to get count of tweets for a particular query.
Later I am using same parameters/query for fetch the tweets for same duration using https://api.twitter.com/2/tweets/search/recent
However, while fetching tweets I am getting less count than I got in count API.

Example:

query parameters for count:
query_params_counts = {"query": "keyword -is:retweet  lang:en",
              "granularity":"day",
              "start_time":"2022-05-09T00:00:00.000Z",
              "end_time":"2022-05-010T00:00:00.000Z"
              } 

for this count is coming: 1766


query_params_tweets = {"query":"keyword -is:retweet  lang:en",
            "start_time":"2022-05-09T00:00:00.000Z",
            "end_time": "2022-05-010T00:00:00.000Z",
            "max_results": 100,
            "expansions": "author_id,attachments.media_keys,entities.mentions.username",
            "tweet.fields": "id,text,created_at,attachments,public_metrics",
            "user.fields": "id,name,username,created_at,description,profile_image_url,location,public_metrics,url",
            "place.fields": "full_name,id,country,country_code,geo,name,place_type",
            "media.fields": "media_key,type,url",
            "next_token": {}
            }

for this count is: 1751

I tried running multiple times but result remained same.
Could someone please help me understand what could be the reason for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦回旧景 2025-02-03 12:20:01

这被解释了

请注意: 计数并不总是与将从搜索端点返回的结果匹配,因为搜索端点会通过额外的合规性,即计数端点不通过

This is explained in the docs:

Please note: The counts will not always match the result that will be returned from search endpoints because the search endpoints go through additional compliance that the counts endpoints do not go through

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文