Details about the parameters of Client.search_all_tweets:
query – the keyword to search for
end_time and start_time – end time and start time, it is required to follow the RFC 3339 time format
expansions, media_fields, place_fields, poll_fields, tweet_fields, user_fields – these are additional information for tweets, which can be selected as needed.
since_id, until_id – the minimum and maximum tweet id, if these two parameters are written, the search will be performed within the range of these two tweet ids.
max_results——The maximum number of results returned by a single request, if not written, the default is 10, and the maximum return is 100.
limit – the number of iterations, here is two iterations, because if the speed is fast, there will be a 429 error, so the manual speed limit is set, and the interval between two requests is 5 seconds.
note: It’s very useful and convenient
import tweepy client = tweepy.Client("Bearer Token here") for response in tweepy.Paginator(client.get_users_followers, 2244994945, max_results=1000, limit=5): print(response.meta) for tweet in tweepy.Paginator(client.search_recent_tweets, "Tweepy", max_results=100).flatten(limit=250): print(tweet.id)