Search code examples
pythontwittertwitterapi-python

Twitter: api.user_timeline limit


I want to extract 1000 tweets from these two following twitter profiles, but the limit is only 200, how can I make it to extract 1000. I even set the count to 5000 and the limit is only 200. The following is the code:

kj_tweets = api.user_timeline(screen_name= "rrrr", count= 5000, include_rts= True, tweet_mode = "extended")
print("Number of tweets extracted: {}.\n".format(len(kj_tweets)))


Ct_tweets = api.user_timeline(screen_name= "xxxx", count= 5000, include_rts= True, tweet_mode= 'extended')
print("Number of tweets extracted: {}.\n".format(len(Ct_tweets)))

Number of tweets extracted: 200.

Number of tweets extracted: 200

.


Solution

  • This is a problem with twitter. They only allow you to extract a certain amount at a time or else you can get locked out.

    https://developer.twitter.com/en/docs/twitter-api/v1/tweets/timelines/api-reference/get-statuses-user_timeline

    If you look at this under parameters, the parameter of count you can see that it says there is a maximum of 200 tweets that can be retrieved per distinct request.