bear / python-twitter

A Python wrapper around the Twitter API.
Apache License 2.0
3.41k stars 955 forks source link

Remove tweet shortening and display the full text #678

Closed ghost closed 3 years ago

ghost commented 3 years ago

how to disable tweet shortening at the end?

and crypto in 2020 and the exte… https://t.co/i89eOwpLC6

see the link for full unshortened tweet.

Can at least the link be removed to get some more tweet chars in there? The resp = self._RequestUrl(url, 'GET', data=parameters) seems to at least include "truncated":true,, can this flag be forcibly enabled, workaround?

Code


            tweets_ = self._api.GetUserTimeline(user_id=user_id,
                                                since_id=since_id,  # >
                                                count=200,
                                                include_rts=True,
                                                trim_user=True,
                                                exclude_replies=True)
ghost commented 3 years ago

during init set tweet_mode: extended, see https://python-twitter.readthedocs.io/en/latest/changes_to_tweet_counting.html?highlight=tweet_mode#tweet-mode

jimniDev commented 3 years ago

Can I ask how did you figure out this issue? It also happens to me and I want to get full text either. I think it happens to tweets contain url links (things that twitter doesnt regard as text so it must be <140, but not for this module, or api) Did you change tweet_mode to compatibility ? or something? Thank you in advance.

ghost commented 3 years ago

barely remember but:

twitter.Api(**api_kwargs) # with   tweet_mode: extended
tweets = self.get_tweets(<userid>)

some tweets seem still to be limited

The-town commented 2 years ago

You can get the full text below.

api = twitter.Api(**api_kwargs, tweet_mode='extended')
tweets = get_tweets(api=api, screen_name=screen_name)

Reference Code https://github.com/bear/python-twitter/blob/1a148ead5029d06bec58c1cbc879764aa4b2bc74/twitter/api.py#L215