Home > Mobile >  Twitter API to fetch Tweets in Python
Twitter API to fetch Tweets in Python

Time:10-28

I'm trying to fetch Tweets from multiple Twitter accounts and then create a database with the TWEETS and the source of the TWEET " user name " by using the following code

posts = api.user_timeline(screen_name = 'AlArabiya_Brk', count = 100 , lang = 
"ar",tweet_mode="extended")
df = pd.DataFrame([tweet.full_text for tweet in posts], columns = [ 'Tweets'])

but I have a question: how can I add more than one account? I tried doing:

posts = api.user_timeline(screen_name = ['AlArabiya_Brk','AJABreaking'], count = 100 
,lang ="ar",tweet_mode="extended")

but didn't get the desired output

CodePudding user response:

You'll need to make multiple calls with that method.

That API endpoint only allows a single screen name input.

  • Related