Twitter API不会返回搜索结果,即使它们存在

2024-04-20 11:34:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试获取一个用户的所有tweets在2个月的时间段。在搜索中,我看到结果,但这段代码返回一个空数组。为什么?在

results = api.GetSearch(raw_query="q=&from=yikyakapp&since=2014-09-24&until=2014-11-24")

    print(results)

Tags: 代码用户fromapiraw数组queryresults
1条回答
网友
1楼 · 发布于 2024-04-20 11:34:19

这是因为Twitter搜索API的限制是7天。检查API documentation

The Twitter Search API searches against a sampling of recent Tweets published in the past 7 days.

这里有详细的解释https://dev.twitter.com/rest/reference/get/search/tweets

Keep in mind that the search index has a 7-day limit. In other words, no tweets will be found for a date older than one week.

总之,你不能使用twitterapi搜索超过7天的tweet。当然,在网站上,他们可以向你展示他们想要的任何东西。它们保存着所有的数据。在

相关问题 更多 >