Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Status doesn't properly load extended tweets from streaming APIs #506

Description

@robmathers

Summary

The Status.NewFromJsonDict method doesn't properly load extended tweets with an extended_tweet payload, which is how the streaming APIs provide extended tweets

Steps to Reproduce

  1. 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.
  2. Use Status.NewFromJsonDict to convert the JSON dict to a Status.
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions