def convert_truncated(tweet):
"""Converts a tweet in extended compatibility mode to a fully extended tweet.
These come from the Streaming API, and python-twitter will only extract a legacy style tweet.
See https://dev.twitter.com/overview/api/upcoming-changes-to-tweets for details and https://github.com/twitterdev/tweet-updates/blob/master/samples/initial/compatibilityplus_extended_13997.json for an example.
This hasn't been tested extensively, so may break in some cases, but seems to work so far."""
raw_tweet = tweet._json
if raw_tweet.has_key('extended_tweet'):
for key, value in raw_tweet['extended_tweet'].items():
raw_tweet[key] = value
converted_tweet = Status.NewFromJsonDict(raw_tweet)
return converted_tweet
评论列表
文章目录