Skip to content

Sentimental Analysis of comments on YouTube videos. Classify comments as positive, negative, or neutral. Provide visualizations to display the distribution of the sentiments.

License

Notifications You must be signed in to change notification settings

LasithaAmarasinghe/YouTube-Comment-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

▶️ Watch the demo

🚀 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
  • 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

Python Jupyter Notebook Matplotlib vaderSentiment Emoji NumPy flask html5 css3

📖 Setup Instructions

  1. Clone the repository:

    git clone https://github.com/LasithaAmarasinghe/YouTube-Comment-Analysis.git
  2. Navigate to the project directory:

    cd YouTube-Comment-Analysis
  3. Install dependencies:

    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.
    • 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:
    API_KEY = 'your_api_key_here'  # Replace with your actual API key
  5. Run the Flask application:

    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 file for details.

About

Sentimental Analysis of comments on YouTube videos. Classify comments as positive, negative, or neutral. Provide visualizations to display the distribution of the sentiments.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published