tweepy

2017-03-09 6 views
6

के साथ "user_timeline" से पूर्ण ट्वीट टेक्स्ट प्राप्त करना मैं स्क्रिप्ट का उपयोग कर उपयोगकर्ता की टाइमलाइन से ट्वीट्स लाने के लिए tweepy का उपयोग कर रहा हूं here। हालांकि, ट्वीट्स छोटा में आ रहे हैं:tweepy

auth = tweepy.OAuthHandler(consumer_key, consumer_secret) 
auth.set_access_token(access_key, access_secret) 
api = tweepy.API(auth) 
new_tweets = api.user_timeline(screen_name = screen_name,count=200, full_text=True) 

रिटर्न:

Status(contributors=None, 
    truncated=True, 
    text=u"#Hungary's new bill allows the detention of asylum seekers 
      & push backs to #Serbia. We've seen push backs before so\u2026 https:// 
      t.co/iDswEs3qYR", 
      is_quote_status=False, 
      ... 

यही है, कुछ i के लिए, new_tweets[i].text.encode("utf-8") प्रतीत होता है जहां बाद में ... लेख से बदल जाता

तरह
#Hungary's new bill allows the detention of asylum seekers & 
push backs to #Serbia. We've seen push backs before so…https://t.co/ 
iDswEs3qYR 

जो आमतौर पर ट्विटर पर प्रदर्शित किया जाएगा।

क्या किसी को पता है कि मैं अपने अनुरोध पर पूरा पाठ प्राप्त करने के लिए truncated=True को ओवरराइड कैसे कर सकता हूं?

फिर, पाठ के बजाय आप full_text पूर्ण ट्वीट पाठ प्राप्त करने के लिए उपयोग करना चाहिए

+0

क्या आपको लगता है कि वापसी प्राप्त करने के लिए कर रहे हैं? –

+0

धीमी उत्तर के लिए खेद है, बस यह देखा - मैं बस सुंदरता 'new_tweets [0] 'हूँ। – atkat12

+0

[ट्वीपी ट्रंकेटेड स्टेटस] का संभावित डुप्लिकेट (http://stackoverflow.com/questions/42050289/tweepy-truncated-status) – mountrix

उत्तर

8
full_text के बजाय

= सच आप tweet_mode = "विस्तारित" की जरूरत है।

आपका कोड तरह दिखना चाहिए:

new_tweets = api.user_timeline(screen_name = screen_name,count=200, tweet_mode="extended") 

फिर आदेश पूर्ण ट्वीट्स पाठ प्राप्त करने के लिए:

tweets = [[tweet.full_text] for tweet in new_tweets]

+1

अभी यह देखने के लिए खेद है! लेकिन आपका जवाब वास्तव में सहायक था, धन्यवाद। – atkat12

संबंधित मुद्दे