The code below only collect 5 tweets... I really couldn't figure it out what is wrong with it? Can anyone help me please?
client = tweepy.Client(
consumer_key=consumer_key,
consumer_secret=consumer_key_secret,
access_token=access_token,
access_token_secret=access_token_secret
)
keywords = '#RadioactiveWaste'
colums = ['User_name', 'Tweet', 'Tweet_ID', 'Time']
data = []
page_num = 35 #collect 3500 tweets
page_num += 1
tweets = []
until_id = None
for i in range(0, page_num,100):
response = client.search_recent_tweets(query=keywords, max_results=100, user_auth=True, until_id=until_id)
if len(response.data) == 0:
break
tweets_chunk = response.data
tweets.extend(tweets_chunk)
until_id = tweets_chunk[-1].id
for tweet in tweets:
tweet_id = tweet.id
tweet_text = tweet.text
tweet_time = tweet.created_at
user_id = tweet.author_id
data.append([tweet_id, tweet_text, tweet_time, user_id])
df = pd.DataFrame(data, columns=colums)
df
I wish the number of tweets I can get reach my setting.