2017-03-09 6 views
6

tweepyを使用して、hereのスクリプトを使用してユーザーのタイムラインからツイートを取得しています。しかし、ツイートは切り捨てに来ている:tweepyで "user_timeline"から完全なツイートテキストを取得

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) 

戻り値:

、いくつかの iため、

後者で ...がテキストを置き換え
#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 

ようnew_tweets[i].text.encode("utf-8")表示され

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, 
      ... 

通常はTwitterに表示されます。

私の要求に全文を手に入れるためにtruncated=Trueをどのように上書きできるか知っていますか?代わりにfull_textの

+0

あなたはそのリターンを受け取るために何をしている:フルつぶやきのテキストを取得するために、次に

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

? –

+0

遅い返事をして申し訳ありません、ちょうどこれを見ました - 私はちょうど 'new_tweets [0]'を印刷しています。 – atkat12

+0

[Tweepy Truncated Status]の重複している可能性があります(http://stackoverflow.com/questions/42050289/tweepy-truncated-status) – mountrix

答えて

8

= trueを使用すると、=「拡張」tweet_modeが必要

はその後、テキストの代わりに使用すると、フルツイートテキストを取得するためにfull_textを使用する必要があります。

あなたのコードは次のようになります。

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

+1

申し訳ありません、今すぐご覧ください!しかし、あなたの答えは本当に役に立ちました、ありがとう。 – atkat12

関連する問題