File size: 441 Bytes
48f3dfc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import snscrape.modules.twitter as sntwitter
import pandas as pd
query = "(@Safaricom_Care) until:2022-10-24"
tweets = []
limits = 5000
for tweet in sntwitter.TwitterSearchScraper(query).get_items():
#print(vars(tweet))
#break
if len(tweets) == limits:
break
else:
tweets.append([tweet.date, tweet.user.username,tweet.content])
df = pd.DataFrame(tweets, columns=['Date', 'User', 'Tweet'])
df.to_csv('safaricomDataset.csv')
|