Search code examples
pythontwitter-search

limit TwitterSearch API, python


How would I limit the number of results in a twitter search?

This is what I thought would work...tweetSearchUser is user input in another line of code.

tso = TwitterSearchOrder() # create a TwitterSearchOrder object
    tso.set_keywords(["tweetSearchUser"]) # let's define all words we would like to have a look for
    tso.setcount(30)
    tso.set_include_entities(False) # and don't give us all those entity information

Was looking at this reference

https://twittersearch.readthedocs.org/en/latest/advanced_usage_ts.html

tried this, seems like it should work but can't figure out the format to enter the date...

tso.set_until('2016-02-25')

Solution

  • You should use set_count as specified in the documentation.
    The default value for count is 200, because it is the maximum of tweets returned by the Twitter API.