0

I'm a nub when it comes to python. I literally just started today and have little understanding of programming. I have managed to make the following code work:

from twitter import *

config = {}
execfile("config.py", config)

twitter = Twitter(
    auth = OAuth(config["access_key"], config["access_secret"],       
config["consumer_key"], config["consumer_secret"]))

user = "skiftetse"

results = twitter.statuses.user_timeline(screen_name=user, count=(1000), include_rts=True)
for status in results:
print "(%s) %s" % (status["created_at"], status["text"].encode("ascii",   
"ignore"))

I was told that the API will only let you retrieve the most recent 3,200 Tweets, however you can only retreive 200 per distinct request. How can I get past the first 200 and move on to retrieve...say 1000?

Would it also be possible to make a chart that shows the posts and how many times it was retweeted?

I would really appreciate help with this! I'm doing this for a research sentiment analysis, so I need a large size to analyze. Thanks!

  • Check the Twitter API documentation. Many RESTful APIs that have a `limit` (like `count`) also have something like `offset` so that you can paginate through results. PS: Consider whether or not the Streaming API is more useful for what you're trying to accomplish. – Wesley Baugh Oct 26 '15 at 00:27

1 Answers1

0

when you request first time it gives you 200 records but the last status id would become your "since_id" when you call with "since_id" you will get next 200 tweet of that user

s = twitter.statuses.user_timeline(screen_name=user, count=(1000), since_id = since_id)