Reputation: 185
I noticed that using the below code, I cannot retrieve the long tweet; somehow it got cut. Can anyone suggest a way to retrieve the full tweet message?
tweets = []
#for month in range(8,13,1):
for i,j in zip(start_time,end_time):
print(i)
print(j)
for response in tweepy.Paginator(client.search_all_tweets,
query = 'สมอง -is:retweet lang:th',
user_fields = ['username', 'public_metrics', 'description', 'location'],
tweet_fields = ['created_at', 'geo', 'public_metrics', 'text'],
expansions = ['author_id', 'geo.place_id'],
start_time = i,
end_time = j):
#max_results=500):
time.sleep(1)
tweets.append(response)
Upvotes: 0
Views: 143
Reputation: 9434
I'm unable to reproduce your snippet since I don't have the credentials but can you try something like this:
import tweepy
client = tweepy.Client("paste your token")
query = 'สมอง -is:retweet lang:th'
tweets = tweepy.Paginator(client.search_recent_tweets, query=query,
user_fields = ['username', 'public_metrics', 'description', 'location'],
tweet_fields=['created_at', 'geo', 'public_metrics', 'text'],
max_results=100).flatten(limit=1000)
for tweet in tweets:
print(tweet.text) ## this should give you the full tweet
Please note to change the respective search method (search_all_tweets). I couldn't use it since it was asking for credentials for v2. You can also get rid of the flatten
if you don't want only the data part of your tweet.
Upvotes: 1