Only maximum of 10 days using search api

search
sandbox
api
premium

#1

I am using the search api to find some tweets. The max return range is 10 days. I signed up for the premium subscription and connected my app to “Search Tweets: 30-Days / Sandbox”. But still only max 10 days of tweets are returned, in my case 714 tweets where upto 2000 or more are possible. Am I using the correct API to do more than a 10 days search?

Below the example code in python:
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)
tweets = tweepy.Cursor(api.search, q = “stroomstoring”, count = 2000, result_type = “recent”,
include_entities = True, lang = “nl”).items()

df_api = []
for t in tweets:
df_api.append({‘datetime’: t.created_at, ‘tweet’: t.text})

df_api = pd.DataFrame(df_api)


#2

The premium 30-day search API uses different endpoints to the standard API so you will not be able to use tweepy for this. You can find an alternative Python library here https://github.com/tw-ddis/twitter_search_api

Your app will also need to have been approved for access to the premium beta.


#3