Unable to use snscrape

34 Views Asked by At

I am trying to use snscrape to extract latest tweets from X, however this code is not working for me. AttributeError: 'FileFinder' object has no attribute 'find_module'

import snscrape.modules.twitter as sntwitter
import pandas as pd

# Created a list to append all tweet attributes(data)
attributes_container = []

# Using TwitterSearchScraper to scrape data and append tweets to list
for i,tweet in enumerate(sntwitter.TwitterSearchScraper('from:john').get_items()):
    if i>100:
        break
    attributes_container.append([tweet.date, tweet.likeCount, tweet.sourceLabel, tweet.content])
    
# Creating a dataframe from the tweets list above 
tweets_df = pd.DataFrame(attributes_container, columns=["Date Created", "Number of Likes", "Source of Tweet", "Tweets"])

The error I am getting is this:

AttributeError: 'FileFinder' object has no attribute 'find_module'
0

There are 0 best solutions below