Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a users entire twitter timeline with tweepy

I am trying to retrieve a list that contains the entire contents of my personal twitter statuses with python and tweepy.

I have successfully authenticated via OAuth but cannot seem to recieve more than about 800 status updates from twitter. My twitter bio page says I have over 2000 tweets. I am well within the 3200 tweet limit Twitter imposes on us.

Any help would be greatly appreciated!

This is my current code (minus OAuth API authentication):

for page in tweepy.Cursor(api.user_timeline, count=200).pages(16):
    page_list.append(page)
    n = n+1
    print n

for page in page_list:
    for status in page:
       print status.text
like image 517
Tim Bueno Avatar asked Jul 05 '12 20:07

Tim Bueno


People also ask

How can I get more than 100 tweets on Tweepy?

If you need more than 100 Tweets, you have to use the paginator method and specify the limit i.e. the total number of Tweets that you want. Replace limit=1000 with the maximum number of tweets you want. Replace the limit=1000 with the maximum number of tweets you want (gist).

How many tweets can you pull with Tweepy?

Tweepy provides the convenient Cursor interface to iterate through different types of objects. Twitter allows a maximum of 3200 tweets for extraction.


1 Answers

You need to specify include_rts=True as a parameter to api.user_timeline; retweets are not included by default. If you retweet a lot of things, this is likely where your missing tweets have gone.

like image 196
Sam Avatar answered Sep 22 '22 19:09

Sam