I want to download tweets of two users at the same time. So far I' ve downloaded tweets of one user. Here is some code.
tweetsL = []
try:
user_timeline = twitter.get_user_timeline(screen_name= 'PrimeministerGR', count=100, tweet_mode = 'extended')
except:
print("Error getting tweets:")
print(len(user_timeline) , "tweets")
# We add the text of the tweet in the list we create
for tweet in user_timeline:
tweetsL.append(tweet)
You could just access the same API endpoint multiple times for all users you are interested in. Also, instead of iterating over the tweets and appending them one by one, you can use the method
extend, which works just likeappend, but expects a list of items to be added to the original list.EDIT: To process the tweets in
tweetsLe.g. print them, just use another loop similar to looping over the users: