Back

Project - Twitter scraping

Created 2 years ago
140 Views
1 Comments
Petchiammal
@Petchiammal
Petchiammal
@PetchiammalProfile is locked. Login

import snscrape.modules.twitter as sntwitter

import pandas

# Creating list to append tweet data to

tweets_list2 = []

# Using TwitterSearchScraper to scrape data and append tweets to list

for i,tweet in enumerate(sntwitter.TwitterSearchScraper('COVID Vaccine since:2021-01-01 until:2021-05-31').get_items()):

if i>5000:

break

tweets_list2.append([tweet.date, tweet.id, tweet.content, tweet.user.username])

# Creating a dataframe from the tweets list above

tweets_df2 = pd.DataFrame(tweets_list2, columns=['Datetime', 'Tweet Id', 'Text', 'Username'])

For the above code, I get the following error

Comments
Please login to comment.