New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search stopping because search_metadata.next_results missing #6
Comments
Thanks a lot for submitting this issue! From what you're saying it sounds like a bug in the library as errors within the Twitter API should result in non 200 HTTP status codes. All those statuses will cause an exception by default - this is especially the case when you reach your limitations. The problem is caused in line 65 in TwitterSearch.py:
If you can, please tell me what's stored in your instance of
|
I actually don't agree that it is necessarily a bug. It is more a question on the twitter API I think. |
I tried again, and I couldn't reproduce it. Apologies for the false alarm. |
The next_results parameter is only available if there are more Tweets you can access by the API. I also wondered how you saw that there is no next_results returned, as the library automatically raises an StopIteration exception which causes the loop to terminate without any other exceptions. However, if you encounter any other strange behavior just drop me message :) |
The behaviour I got was that I only got back a little bit less than 'count' tweets in total every time. The loop terminated without any exception, but I expected more results. Every time I started the loop again, I only got one 'page' back (no exceptions). I added some debug print messages in the code to find out why it is not performing another query to get more results - that was when I discovered the missing 'next_results' element. |
I think I managed to re-produce this. Still think it is a problem with the twitter API.
You'll notice that the last response does not include a 'next_results' element.
This shows that there are in fact more results.. so I'm not sure why twitter stopped sending the 'next_results' element in the first set. |
Oh that's quite interesting... I just had a look what dev.twitter.com is saying about this. It seems that pages are not the best idea to search for tweets, which is perfectly logical considered the constant change within the pages of Tweets: https://dev.twitter.com/docs/working-with-timelines I try to improve TwitterSearch for not using any pages but IDs. |
I agree. I basically implemented my own max_id navigation while still using your 'searchTweets' function.
|
Thanks for this library. Working very well.
This is more of a question on the twitter api I guess, but maybe you've encountered this before.
Every now and again, I find that the search (iterating using searchTweetsIterable) stops because in the twitter response, the search_metadata.next_results item is completely missing. Do you know of a good reason why this is happening? I don't see anything about this in the API documentation. It is also not due to rate limitation.
If I manually run another search with my own max_id populated, I get another set of results, again with the search_metadata.next_results missing.
The text was updated successfully, but these errors were encountered: