-
-
Save quantra-go-algo/2124445a9f482c32f4795f007b2c8265 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shall we check out this user's tweets? | |
name = 'elonmusk' | |
# Fetch user data | |
user=client.get_user(username=name).data | |
# Extract the user id and user name | |
user_id = user.id | |
user_name = user.name | |
# Fetch tweets by the user | |
tweets = client.get_users_tweets(id=user_id, tweet_fields=['id', 'text', 'created_at', 'context_annotations']) | |
print(f"Here are the recent tweets by {user_name}:\n") | |
for tweet in tweets.data: | |
print(tweet.created_at,'\n', tweet,"\n", tweet.context_annotations,"\n\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment