Getting the full text of a tweet from "user_timeline" with tweepy

I use tweepy to get tweets from a custom timeline using the script included here . However, tweets go truncated:

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)
api = tweepy.API(auth)
new_tweets = api.user_timeline(screen_name = screen_name,count=200, full_text=True)

Return:

Status(contributors=None, 
     truncated=True, 
     text=u"#Hungary new bill allows the detention of asylum seekers 
          & push backs to #Serbia. We've seen push backs before so\u2026 https:// 
          t.co/iDswEs3qYR", 
          is_quote_status=False, 
          ...

That is, for some i, it new_tweets[i].text.encode("utf-8")appears as

#Hungary new bill allows the detention of asylum seekers & 
push backs to #Serbia. We've seen push backs before so…https://t.co/
iDswEs3qYR

Where ...in the latter replaces the text that is usually displayed on Twitter.

Does anyone know how I can override truncated=Trueto get the full text on my request?

+6
source share
1 answer

Instead of full_text = True, you need tweet_mode = "extended"

full_text .

:

new_tweets = api.user_timeline(screen_name = screen_name,count=200, tweet_mode="extended")

, :

tweets = [[tweet.full_text] for tweet in new_tweets]

+9

Source: https://habr.com/ru/post/1015634/


All Articles