This is a Python project that analyzes the sentiment of comments on YouTube videos. It uses the VADER sentiment analysis tool and TF-IDF to provide further information on what the comments think about the video. It also has a frontend powered by Flask.
-
Fetch comments from YouTube videos using the YouTube Data API.
-
Analyze the sentiment of comments using VADER.
-
Generate a wordcloud from the most important words.
- Python with PIP installed
- YouTube Data API key
Note
Although this is a NodeJS project too, having node_modules installed is required only if editing TailwindCSS.
-
Clone the repo:
$ git clone https://github.com/keanegrech/youtube-sentiment-analyzer.git $ cd youtube-sentiment-analyzer
-
Set up your API key:
- Rename
example.env
to.env
- Add your API key to
YSA_DATA_API_KEY="your key here"
- Rename
-
Run setup.py to install all required dependencies.
-
Run the Flask app:
Start the Flask web server to use the frontend
$ python main.py
-
Access the web interface
Open your web browser and go to http://127.0.0.1:5000
The default port is 5000, it can be changed from the .env file.
-
Fetch comments:
Enter either a YouTube URL or video ID followed by the sample size of comments to begin processing.
-
Results:
- You can see the videos title, like and comment count
- See overall sentiment
- See most positive and negative comment and their respective sentiment scores
- Download comments as a txt file
- Download word cloud of most important words