I’m trying to count how many tweets over the last week mention a particular keyword. I’m trying to do this using the Search API.
First thing I’m trying to do is fetch all the tweets mentioning the keyword going back over the last week. To do this, I’m making a GET request to the Search API, getting the maximum ID from the results, and setting since_id equal to the maximum plus one, and then repeating the search with the given since_id. I continue this until search_metadata.count is 0.
The problem with this is that either:
- this ends in an infinite loop where the max tweet id stays the same, which can only happen if the since_id is ignored
- or the max tweet id is -Inf which can only happen if the number of tweets that I get back is 0 while search_metadata.count != 0.
Why is this happening?