The goal of this project is to analyze the public's general sentiment towards Netflix. This is accomplished by scraping tweets from Twitter (or X) that include the word "Netflix," detecting the emotion behind the tweet using the text2emotion library, summing the total sentiment behind all tweets, and visualizing the results in a pie chart.
To run this project you will want to replace the parameters <your-bearer-token>
and <your-twitter-username>
with your own credentials. Your bearer token can be generated by setting up developer access on developer.twitter.com.
Run pip install -r requirements
in this project's home directory to install all necessary tools for running this project.
For ease of use, I wrote a shell script called tweet-analytics.sh
to run through all the steps chronologically. If you wish to run an individual step, you can copy and paste that step from this script to your command line.
To execute this script on Mac OS or Linux, run chmod +x run_classifier.sh
once in this project's home directory to set the execution permissions. Then, it can be executed by running ./tweet-analytics.sh
or sh tweet-analytics.sh
in this project's home directory.
If running on a Windows command line, this script can be executed by running bash tweet-analytics.sh
.
My results from running this experiment are shown below.
With recent Twitter updates, scraping tweets may not be available with the free version of Twitter Developer.