简体   繁体   中英

Twython Twitter Post is Truncated

I'm trying to get some tweets using Twython, but even with tweet_mode:extended the results are still truncated. Any ideas how I can get the full text.

def requestTweets(topic, resultType = "new", amount = 10, language = "en"):
'''Get the n tweets for a topic, either newest (new) or most popular (popular)'''
#Create Query
query = {'q': topic,
        'result_type': resultType,
        'count': amount,
        'lang': language,
        'tweet_mode': 'extended',
        }

#Get Data
dict_ = {'user': [], 'date': [], 'full_text': [],'favorite_count': []}
for status in python_tweets.search(**query)['statuses']:
    dict_['user'].append(status['user']['screen_name'])
    dict_['date'].append(status['created_at'])
    dict_['full_text'].append(status['full_text'])
    dict_['favorite_count'].append(status['favorite_count'])

# Structure data in a pandas DataFrame for easier manipulation
df = pd.DataFrame(dict_)
df.sort_values(by='favorite_count', inplace=True, ascending=False)
return df

tweets = requestTweets("chocolate")
for index, tweet in tweets.iterrows():
    print("***********************************")
    print(tweet['full_text'])

Results look like this:

在此处输入图像描述

I know it's kind of late. but I put the answer to whom may need it.

I'm using twython==3.9.1 and its possible to get the full text of tweets with the below snippet code:

twython: Twython
tweets = twython.get_user_timeline(
        screen_name=user_screen_name, # or user id
        count=200, #  max count is 200
        include_retweets=include_retweets, # could be False or True
        exclude_replies=exclude_replies, # could be False or True
        tweet_mode='extended', # to get tweets full text
    )

I couldn't find a way to do it with Twython, so I switched to tweepy in the end, still, if anyone has an answer, that would be great.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM