Sean
Sean

Reputation: 51

Twitter API doesn't return search results even though they exist

Im trying to get all of a user's tweets for a 2 month time period. In search I see results but this code returns an empty array. Why?

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

    print(results)

Upvotes: 1

Views: 1480

Answers (1)

Unni
Unni

Reputation: 5794

This is because Twitter search API has a limit of 7 days. Check the API documentation

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

There is a detailed explanation here 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.

In summary, you can't use Twitter API to search for tweets beyond 7 days. Of course, in the website they can show you whatever they want. They hold all the data.

Upvotes: 1

Related Questions