Search code examples
pythontwittertweepytwitter-search

Tweepy Status.text doesn't return full text


Okay so I would like to get the latest tweet of @MZ_GOV_PL, it's this retweet at this moment:

https://twitter.com/NFZ_Centrala/status/1316416216295182337

And I would like to get the full text of it, so I've written this code:

def get_Latest_Tweet():
    consumer_key = ""
    consumer_secret = ""
    access_token = ""
    access_token_secret = ""

    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_token, access_token_secret)

    api = tweepy.API(auth)
    statuses = api.user_timeline(id=462886126)
    print(statuses[0].text)

It's the whole code, in other place I've just got line to start it I tried to solve it using status.full_text instead of one I'm using right now, but I don't get it, it just doesn't work


Solution

  • Ok, so i worked out an answer, everything is pretty simple. In it's natural state it returns only 140 chars, so instead of

    statuses = api.user_timeline(id=462886126)
        print(statuses[0].text)
    

    I just needed:

    statuses = api.user_timeline(id=462886126, tweet_mode='extended')
        print(statuses[2].full_text)