Gathering User Data from Twitter

Gathering User Data from Twitter

di CHELSIE ADELLE RENESSA ROMAIN -
Numero di risposte: 2

Hello everyone. I am attempting to modify the code from lab 1 to return user data instead of tweet data. There are 3 helper functions created by Lejla in lab 1: create_url, connect_to_endpoint and get_data. I'm using the get_data function but I changed the endpoint to "https://api.twitter.com/2/users/:id" and i changed the user_fields to "screen_name,name,id_str,description,profile_image_url".  And my query is the user_id which was optained from tweet data.

The idea is to get tweet data using the code from lab 1 and then take the list of user_id's (i.e. the person who posted each tweet) and find out more information about them. I have already tried adding the user fields i mentioned above to the original tweet query and it does not work.

If anyone has any ideas on how I can fix this so that it works or if you need more information please let me know, thanks!


In riposta a CHELSIE ADELLE RENESSA ROMAIN

Re: Gathering User Data from Twitter

di CHELSIE ADELLE RENESSA ROMAIN -

I couldn't edit my original post but here I added a few screenshots. The second screenshot is the dataframe containing the tweet data. I took the first author_id 19479767 and attempted to get user information using the code in the first screenshot. However I keep getting the error at the bottom of the first screenshot. The user id is valid because it was just returned by the tweet data. Also the 'id' column of the data frame refers to the tweet id NOT the user id, I have already tried and using that does not work either.Code for retrieving user data

Dataframe of tweet data