https://github.com/lasithaamarasinghe/youtube-comment-analysis
Sentimental Analysis of comments on YouTube videos. Classify comments as positive, negative, or neutral. Provide visualizations to display the distribution of the sentiments.
https://github.com/lasithaamarasinghe/youtube-comment-analysis
comment-analysis css3 emoji flask google-api-client html5 matplotlib negative neutral numpy positive python sentiment-analysis sentiment-classification vadersentiment visualization youtube-video
Last synced: about 1 month ago
JSON representation
Sentimental Analysis of comments on YouTube videos. Classify comments as positive, negative, or neutral. Provide visualizations to display the distribution of the sentiments.
- Host: GitHub
- URL: https://github.com/lasithaamarasinghe/youtube-comment-analysis
- Owner: LasithaAmarasinghe
- License: mit
- Created: 2025-03-23T16:24:36.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-06-18T11:18:02.000Z (8 months ago)
- Last Synced: 2025-06-18T12:30:17.163Z (8 months ago)
- Topics: comment-analysis, css3, emoji, flask, google-api-client, html5, matplotlib, negative, neutral, numpy, positive, python, sentiment-analysis, sentiment-classification, vadersentiment, visualization, youtube-video
- Language: HTML
- Homepage:
- Size: 6.79 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE.txt
Awesome Lists containing this project
README
# YouTube-Comment-Analysis
This tool analyzes the sentiment of comments on YouTube videos. It uses sentiment analysis to classify comments as positive, negative, or neutral, and provides visualizations to display the distribution of these sentiments.

## π₯ Demo
Hereβs a quick demo of the **YouTube-Comment-Analysis**:
[](https://vimeo.com/1068613686/94d8fc8668)
## π Features
- **YouTube Comment Analysis**: Fetch and analyze comments on a YouTube video.
- **Sentiment Classification**: Categorizes comments into Positive, Negative, or Neutral sentiments.
- **Visualization**: Displays sentiment distribution as bar and pie charts.
- **Notable Comments**: Highlights the most positive and negative comments with sentiment scores.
## π οΈ Technologies/ Tools
* Jupyter Notebook / [Google Colab](https://colab.research.google.com/)
* Python 3+
* Python packages
* Google API Client - `pip install google-api-python-client`
* VaderSentiment - `pip install vaderSentiment`
* Matplotlib - `pip install matplotlib`
* Emoji - `pip install emoji`
* Numpy - `pip install numpy`
* Flask - `pip install flask`
* HTML5
* CSS3









## π Setup Instructions
1. Clone the repository:
```sh
git clone https://github.com/LasithaAmarasinghe/YouTube-Comment-Analysis.git
```
2. Navigate to the project directory:
```sh
cd YouTube-Comment-Analysis
```
3. Install dependencies:
```sh
pip install -r requirements.txt
```
4. Set Up YouTube API
To interact with the YouTube API, you need an API key. Follow these steps to get a YouTube API key:
* Go to the [Google Developer Console](https://console.developers.google.com/).
* Create a new project.
* Enable the **YouTube Data API v3** for your project.
* Generate an **API key** for your project.
* Paste the generated API key into the `app.py` file under the `API_KEY` variable:
```python
API_KEY = 'your_api_key_here' # Replace with your actual API key
5. Run the Flask application:
```sh
python app.py
```
6. Use the Analysis
* Open your browser and go to `http://127.0.0.1:5000/`.
* Enter the YouTube video URL in the provided input field.
* Click on **"Analyze Comments"** to process the comments of the video.
* The results page will display the sentiment analysis results along with sentiment distribution charts.
## π How This Works
1. **Extract Video ID**: The user provides a YouTube video URL, which is parsed to extract the video ID.
2. **Fetch Comments**: The YouTube Data API fetches up to 1000 comments from the video.
3. **Clean and Filter Comments**: The comments are cleaned (HTML tags removed) and filtered for relevance.
4. **Sentiment Analysis**: Each comment is analyzed using **Vader Sentiment Analysis** to classify it as positive, negative, or neutral.
5. **Visualization**: Visual representations of sentiment distributions are displayed as bar and pie charts.
6. **Display Results**: Results, including sentiment statistics and notable comments, are shown to the user.
## π Results


## π License
* This project is licensed under the MIT License. See the [LICENSE](MIT-LICENSE.txt) file for details.