New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting full_text from truncated tweets #491

Closed
jmlipman opened this Issue Jul 20, 2017 · 5 comments

Comments

Projects
None yet
6 participants
@jmlipman

jmlipman commented Jul 20, 2017

Hi guys,

I realized that when using this library I get truncated tweets and I tried to find a solution. I found on the Internet that there is a parameter called "tweet_mode" that you are supposed to tunned as "extended". However, there is no such parameter in the GetSearch function.

I realized that there is a parameter called raw_query, and I also tried to write something like "q=whatever&tweet_mode=extended" but it didn't work.

I made a workaround and I want to share it because someone might find it useful. You just need to modify a couple of lines:

In the file models.py
In the function NewFromJsonDict from Status
Line 469 (below user_mentions=None)
add: full_text = None

Line 478 (below current_user_retweet = data['current_user_retweet']['id'])
add: if 'full_text' in data:
full_text = data['full_text']

Line (last):
add full_text in the parameters such that:
return super(cls, cls).NewFromJsonDict(data=data,
current_user_retweet=current_user_retweet,
hashtags=hashtags,
media=media,
retweeted_status=retweeted_status,
urls=urls,
user=user,
user_mentions=user_mentions,full_text=full_text)

This is just a workaround but it would be great if it's implemented in the library.

Regards,
JM.

@mejmo

This comment has been minimized.

mejmo commented Dec 25, 2017

This does not work for me either.. When truncated True is, I did not have any property full_text in data..

@zefoo

This comment has been minimized.

zefoo commented Dec 26, 2017

I'm seeing this too. This may be helpful: #506 - Although, I can't seem to get the workaround to work. Maybe you'll have some better luck? I'm curious if you find the solution.

@negi111111

This comment has been minimized.

negi111111 commented Feb 17, 2018

Im also looking for it. Did you find a good solution?

@techieshark

This comment has been minimized.

techieshark commented Mar 3, 2018

One thing: if anyone else runs into this, make sure you have tweet_mode='extended' when you call twitter.Api(). I got thrown off for a while by that.

twitter.Api(
            consumer_key= os.environ['CONSUMER_KEY'],
            consumer_secret= os.environ['CONSUMER_SECRET'],
            access_token_key= os.environ['ACCESS_TOKEN'],
            access_token_secret= os.environ['ACCESS_TOKEN_SECRET'],
            cache=None,
            tweet_mode= 'extended')

jeremylow added a commit that referenced this issue Mar 10, 2018

fix issue with streaming tweets loading extended_tweet data
assigns each node in the extended_tweets dict
to the top-level node
tweet[extended_tweet][entities] > tweet[entities]
for example. this fixes an issue where tweets
were not being fully hydrated from the streaming
apis.

close issue #506; close issue #491
@jeremylow

This comment has been minimized.

Collaborator

jeremylow commented Mar 10, 2018

Fix lands in 564e6bb

@jeremylow jeremylow closed this Mar 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment