DEV Community

Discussion on: Sentiment analysis on Trump's tweets using Python 🐍

Collapse
 
aidilarazak profile image
Aidila Razak

Hi! Thanks for the tutorial.

I noticed that tweets containing RTs are not printed in full. How do I get the full RT text?

I am able to un-trunctate a tweet using this:

if tweet['truncated']:
tweet_text = tweet['extended_tweet']['full_text']
else:
tweet_text = tweet['text']

but it won't work for tweets containing RTs.

Anyone know how I can get the full RTs?

I would need it to get an accurate sentiment analysis.

Many thanks for the help!

Collapse
 
rodolfoferro profile image
Rodolfo Ferro • Edited

Hi!

One possible approach would be adding the tweet_mode parameter as follows:

tweets = extractor.user_timeline(screen_name="realDonaldTrump", count=200, tweet_mode="extended")

Let me know if that does the trick. :)