ideoforms/python-twitter-examples

Set the number of results to return in a search

Btibert3 opened this issue · 3 comments

This script works great, but for a given hashtag, only returns 15 results. Where can I identify the syntax to expand the number of results, or limit the tweets since an id?

Per the twitter API, (https://dev.twitter.com/rest/reference/get/search/tweets) searches default to only 15 results.

I have not tested it, but according to the API, you should be able to change: twitter.search.tweets(q = "lazy dog") into twitter.search.tweets(q = "lazy dog", options=={'count':50}) - or any number below 100. You should be able to add any other options from the API to that list, as well; https://dev.twitter.com/rest/reference/get/search/tweets

Try using this,
twitter.search.tweets(q='#nlproc', result_type='recent', lang='en', count=10)

if you have any other queries related to this you'll find the solution on this website:

http://socialmedia-class.org/twittertutorial.html

Thanks for your comments - glad the query was resolved. Closing this ticket as it is not reporting a bug within the code.