python - Why can't I access more than 25 tweets using tweepy search API? -
i'm using tweepy
in python search tweets. i'm using tweepy.api.search()
query older tweets, , noticed can't access 500 tweets @ once. in fact, can't return more 25.
i have used both count
, rpp (results per page)
keywords. can't seem figure out if i'm not allowed access many tweets @ once, or if buggy. here code:
for tweet in api.search(q='obama', count=500, show_user=false, rpp=500, geocode='38.899722,-77.048363,500mi'): print tweet.created_at, '\n', tweet.text, '\n\n'
this gives me 25 tweets output. here first few show it's working:
2015-04-01 16:42:28 "@jonahmarais: me , michelle obama dating guys" lot twist. april fools day. 2015-04-01 16:42:05 "@jonahmarais: me , michelle obama dating guys" sike. 2015-04-01 16:38:44 forget #winstonchurchill #obama isn't measuring #nevillechamberlain says http://t.co/6jzqxjudrh #irantalks #israel
you can't 500 tweets in single search because maximum value count
parameter 100--it defaults smaller number if put in larger (or negative). looking @ count
parameter in twitter api get search/tweets docs:
count - number of tweets return per page, maximum of 100.
this means can't more 100 results given search. might want check out tweepy cursor easy way search larger quantities of tweets.
Comments
Post a Comment