Double State Tweepy

I used tweepy user timeline data and ran into some difficulties in understanding the following:

  • Is the attribute โ€œretweetedโ€ and โ€œtruncatedโ€ a reference to the same thing (i.e. status text over 140 characters)?
  • If not, what is the difference?
  • I came across a stackoverflow question where someone asked how to get status text that was โ€œshreddedโ€ due to a length of more than 140 characters. He suggested that in the _json dictionary there is a retweeted attribute that will be true if it is, and the full status text will be in status-> retweeted_status-> text. However, I could not find it, and the only status text was in status โ†’ text ending in "...". I got it wrong, and if so, how do I get the full text?

Thanks for your help in advance.

+6
source share
3 answers

"retweeted" "" (.. 140 )? , ?

, (), (. , ). , "" "" ( "" "" "" ). , "retweeted" True, "truncated" False, , 140 .

, _json retweeted, , , - > retweeted_status- > text.

, retweet. retweeted_status , . - tweet_mode='extended' Tweepy ( , Tweepy). :

( )

print api.get_status('862328512405004288')._json['text']

@tousuncotefoot @equipedefrance @CreditAgricole @AntoGriezmann @KMbappe @layvinkurzawa @UmtitiSam J'ai jamais vue d... https://tco/kALZ2ki9Vc

()

print api.get_status('862328512405004288', tweet_mode='extended')._json['full_text']

@tousuncotefoot @equipedefrance @CreditAgricole @AntoGriezmann @KMbappe @layvinkurzawa @UmtitiSam J'ai jamais vue de match de foot et cela ferait un beau cadeau pour mon copain!! ๐Ÿ™๐Ÿป๐Ÿ™๐Ÿป๐Ÿ™๐Ÿป๐Ÿ˜๐Ÿ˜

+8

3)

Tweepy, , 140 ( extended_tweet). 140 , :

class MyStreamListener(tweepy.StreamListener):
    def on_status(self, status):
        try:
            text = status.extended_tweet["full_text"]
        except AttributeError:
            text = status.text
+3

- .

, .json "full_text". full_text retweet_status. :

tweepy.Cursor(api.search, q = "social", tweet_mode = 'extended', wait_on_rate_limit = True, wait_on_rate_limit_notify = True, include_entities = True).items(10): try: print tweet.retweet.im_self. _json ['retweeted_status'] ['full_text'] : print tweet.retweet.im_self._json ['full_text']

0

Source: https://habr.com/ru/post/1015636/


All Articles