Search code examples
resttwittertweetstwitter-rest-api

Is it possible to parse all tweets of user?


For example, I want to parse all tweets of Microsoft .

Twitter has API - GET statuses/user_timeline. But how I can see, This method can only return up to 3,200 of a user’s most recent Tweets.

So, can I parse all tweets of some screen_name?


Solution

  • You might be a bit better with GET search/tweets, adding the query q=@Microsoft.

    However, you will have problems as well:

    1. You'll get all tweets mentioning @Microsoft, not only the ones at the user_timeline. You will have to filter afterwards

    2. Although there is not limit in theory, as the one of 3200 of GET statuses/user_timeline, you probably wont be able to get all tweets from a user. By definition, Twitter API does not provide that kind of service. If you want all tweets you'll need to use a service like topsy (not free)

    3. You'll have to use pagination since every query to GET search/tweets gives you a maximum of 100 tweets, and if you need to get more than 450*100 tweets (remember you'll get a mixture of tweets as pointed out in 1. above), you'll have to handle Twitter rate limits and launch your queries in windows of 15 minutes

    Sorry there is not a simpler answer to your question... Hope it helps anyway.

    (EDIT: 450*100 is assuming you use application-only authentication. If not, it is 180*100)