Senpai
Senpai

Reputation: 83

Getting the latest tweet/retweet and full text of the retweet (Twitter API v2)

I'm trying to get the latest tweet/retweet by appending all my tweets, but I can't get the full text of retweets.

tweets = client.get_users_tweets(
    id='xxxxxxxxxxx',
    tweet_fields=['text']
)

data = []
for tweet in tweets.data:
    data.append(tweet)

print(data[0])

Retweet:

enter image description here enter image description here

Upvotes: 0

Views: 1494

Answers (1)

Senpai
Senpai

Reputation: 83

Since you are using v2, you will need to add the expansions=referenced_tweets.id parameter to your request, and match up the data in the returned includes object to get the text of the original Tweet from the retweet. There is an example of how to do this in this answer

Upvotes: 1

Related Questions