Open aoamusat opened 2 years ago
That's meant for you to do. For example:
tweet_generator = twitter.TwitterSearchScraper("Spacex").get_items()
tweet_list = []
max = 100
for count, tweet in tweet_generator.enumerate():
if count >= max:
break # reached max
tweet_list.append(tweet)
List comprehension would probably work too but I'm at school.
itertools.islice
would be the most elegant approach. But yeah, this is best solved outside of snscrape since there are so many different ways how someone might want to filter results. First n results is probably a somewhat common one, but an itertools.islice
example in the future documentation would be a better solution for that.
The
get_items()
should be passed an argumentn
to specify the number of tweets to get from theTwitterSearchScraper