How to get count data by month for a given keyword




I’m new to this but I’m trying to get a count of the number of tweets made about ‘mosquito’ in the US. Ideally I’d like this weekly but I need it over 4 years and I think that would exceed the rate limit. I’m using the TwitterAPI ( in python if that helps.

Here is my code (after authentication):

search_term = ‘mosquito place_country:US -“try sleeping in a room”’

r = api.request(‘tweets/search/fullarchive/:mosquito/counts’,
{‘query’: search_term,
‘fromDate’: 201812010000,
‘toDate’: 201901010000})

Perviously I got this to work but this method will definitely exceeds the rate limit if I do it over 4 years:

search_term = ‘mosquito place_country:US -“try sleeping in a room”’

r = api.request(‘tweets/search/fullarchive/:mosquito’,
{‘query’: search_term,
‘fromDate’: 201501010000,
‘toDate’: 201901010000,



Are you just looking for counts or do you need all the tweets too?

The second request over 4 years is getting the tweets, not counts:
r = api.request(‘tweets/search/fullarchive/:mosquito’...
instead of
r = api.request(‘tweets/search/fullarchive/:mosquito/counts’,


I was going to get all tweets and then count them by calendar week. Is that possible with a count search? Making a request for each week would definitely exceed my limit but if it can return the counts by week that would be perfect


Basically I’m looking to get a result with weekly count data. This would be for a given location (US) and time period (2015-2018 which is 208 rows). Is this even possible with the rate limits?


I have same problems here, I need to count tweets containing certain hashtags in 3-day intervals. with your example only show the count of all tweets, but I need tweets on certain days. how do i integrate fromdate and todate in api.request?


Counts endpoint is only available if you pay for Premium access, but with that, it’s definitely possible to get counts of tweets without retrieving everything.

I don’t have a paid account to check but have a look at this example of how to use it: the search-tweets-python repo has other stuff that might be useful. to me, seems like a good choice if you know what to do already while has some user friendly additions like a CLI tool and some helper functions

Hope that helps!