From 4515e6131caf45749e0d56560c1b93fccade7f0a Mon Sep 17 00:00:00 2001 From: polluxtroy3758 <2147396+polluxtroy3758@users.noreply.github.com> Date: Sat, 18 Apr 2020 20:36:25 +0200 Subject: [PATCH] Allow extended tweets Add 'tweet_mode = extended' to 'tweepy.Cursor' call Change 'tweet.text.encode("utf-8")' for 'tweet.full_text.encode("utf-8")' to get the full length tweet. --- get_tweets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/get_tweets.py b/get_tweets.py index bd30e31..2fd08b8 100644 --- a/get_tweets.py +++ b/get_tweets.py @@ -26,9 +26,9 @@ def get_tweets(username): #get tweets tweets_for_csv = [] - for tweet in tweepy.Cursor(api.user_timeline, screen_name = username).items(number_of_tweets): + for tweet in tweepy.Cursor(api.user_timeline, screen_name = username, tweet_mode = extended).items(number_of_tweets): #create array of tweet information: username, tweet id, date/time, text - tweets_for_csv.append([username, tweet.id_str, tweet.created_at, tweet.text.encode("utf-8")]) + tweets_for_csv.append([username, tweet.id_str, tweet.created_at, tweet.full_text.encode("utf-8")]) #write to a new csv file from the array of tweets outfile = username + "_tweets.csv"