简体   繁体   中英

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')

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM