You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 7, 2024. It is now read-only.
Load a JSON dict of an extended tweet in Twitter's "Compatibility with additional extended_tweet in payload" mode. You can find a sample here, or use GetStreamSample() and check for tweets with truncated = True.
Use Status.NewFromJsonDict to convert the JSON dict to a Status.
The status will just have a text property, without a full_text, even when the API instance has tweet_mode set to extended. Other extended entities are also not available.
Workaround
By copying the keys from the JSON's extended_tweet object to the root object, NewFromJsonDict properly parses the tweets as an extended tweet, with full_text available.
Example:
# Where json_dict is a dictionary parsed from the JSON of a tweet in this mode
if json_dict.has_key('extended_tweet'):
for key, value in json_dict['extended_tweet'].items():
json_dict[key] = value
converted_tweet = Status.NewFromJsonDict(json_dict)
# converted_tweet.full_text will be populated and not truncated
Summary
The
Status.NewFromJsonDictmethod doesn't properly load extended tweets with anextended_tweetpayload, which is how the streaming APIs provide extended tweetsSteps to Reproduce
extended_tweetin payload" mode. You can find a sample here, or useGetStreamSample()and check for tweets withtruncated = True.Status.NewFromJsonDictto convert the JSON dict to aStatus.textproperty, without afull_text, even when the API instance hastweet_modeset toextended. Other extended entities are also not available.Workaround
By copying the keys from the JSON's
extended_tweetobject to the root object,NewFromJsonDictproperly parses the tweets as an extended tweet, withfull_textavailable.Example: