计算推文/计数/最近和推文/搜索/最近的差异
我正在使用APIV2从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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这被解释了
This is explained in the docs: