Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Sentivibe — YouTube Comment Sentiment Analyzer 🎭

A powerful web application and browser extension that analyzes the sentiment of YouTube comments in real-time.

Live Demo Node.js Chrome Extension

📖 About the Project

Sentivibe is an AI-powered sentiment analysis tool built to instantly classify YouTube comments as positive, negative, or neutral. Designed for content creators, brand managers, and researchers, it fetches real-time comments and provides a visual dashboard of audience reactions directly under any YouTube video. By analyzing viewer feedback at scale, users can monitor their brand reputation, gauge video reception, and extract meaningful insights without manually reading thousands of comments.

✨ Key Features

  • 🔄 Real-Time Comment Fetching: Directly pulls up to thousands of comments per video using the official YouTube Data API v3.
  • 🧠 Smart Sentiment Classification: Accurately categorizes feedback into positive, negative, or neutral sentiments using a local transformer model with fallback logic.
  • 📊 Visual Analytics Dashboard: Displays interactive charts showing overall sentiment distribution.
  • 🏆 Top Comment Highlights: Automatically isolates and highlights the most positively and negatively engaging comments.
  • 💾 Smart Caching Engine: Built-in SQLite cache to prevent redundant API calls and optimize YouTube API quota usage.
  • 🧩 Seamless Extension Integration: Injects the sentiment UI natively into the YouTube viewing experience via a premium Chrome extension.

🛠 Tech Stack

Backend

  • Node.js
  • Express.js
  • SQLite

Machine Learning & NLP

  • Hugging Face (via @xenova/transformers)
  • NLP Sentiment

Frontend / Extension

  • HTML5
  • CSS3
  • JavaScript
  • Chrome Extensions

⚙️ How It Works

  1. Enter YouTube URL: The Chrome extension automatically detects the currently playing YouTube video.
  2. Fetch Comments via API: The backend communicates with the YouTube Data API v3 to retrieve comment threads (with pagination support).
  3. Run Sentiment Model: The backend processes the text using a tiered NLP approach (Local Transformer → HuggingFace Inference API → Sentiment Lexicon).
  4. Display Results: Processed data is sent back to the extension, which renders a sleek dashboard with sentiment charts and top comment highlights directly below the video player.

🚀 Getting Started

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/Monu01123/Sentivibe.git
    cd Sentivibe
  2. Backend Setup

    cd Backend_
    npm install
  3. Configure Environment Variables Create a .env file in the Backend_ directory:

    # .env
    PORT=5000
    YOUTUBE_API_KEY=your_youtube_api_key_here
    
    # Optional: For advanced cloud inference
    HF_API_KEY=your_huggingface_api_key_here
    TRANSFORMER_MODEL=Xenova/distilbert-base-uncased-finetuned-sst-2-english
  4. Start the Server

    npm start
  5. Load the Chrome Extension

    • Open Chrome and navigate to chrome://extensions/
    • Enable "Developer mode" in the top right.
    • Click "Load unpacked" and select the extension_v2 directory.
    • Open a YouTube video to see Sentivibe in action!

🤖 Model & Algorithm

Sentivibe utilizes a multi-layered fallback strategy for sentiment analysis to ensure 100% uptime and fast execution:

  1. Local Transformer (@xenova/transformers): First, it attempts to run a localized, in-memory DistilBERT model. This guarantees high accuracy without relying on paid external APIs.
  2. Hugging Face API: If local execution struggles with resource constraints, it falls back to the Hugging Face Inference API.
  3. Lexicon-based Analysis (sentiment npm package): For extremely rapid or offline fallback, an AFINN-based lexicon approach is used as the baseline classifier.

📝 Sample Output

When the backend classifies comments, the JSON response looks like this:

{
  "videoId": "dQw4w9WgXcQ",
  "totalCommentsAnalyzed": 150,
  "sentimentSummary": {
    "positive": 65,
    "negative": 15,
    "neutral": 70
  },
  "topComments": {
    "positive": "This is an absolute masterpiece! Loved every second of it.",
    "negative": "The pacing was terrible and the audio quality is bad."
  }
}

💡 What I Learned

Building this project provided several critical technical insights:

  • API Integration & Quota Management: Learned how to effectively paginate through the YouTube Data API while implementing an SQLite caching layer to avoid rate limits and reduce redundant API calls.
  • NLP & Sentiment Analysis: Gained deep knowledge of deploying machine learning models in a Node.js environment, especially working with WebAssembly-based local transformers versus cloud APIs.
  • Data Visualization: Mastered techniques to clean and aggregate raw textual data into structured statistical models suitable for dynamic chart rendering in the DOM.
  • Handling Large Comment Datasets: Navigated performance bottlenecks when parsing asynchronous streams of thousands of comments simultaneously, optimizing the Node event loop.

🔮 Future Improvements

  • Multilingual Support: Integrating translation APIs or polyglot models to analyze comments in multiple languages.
  • Real-Time Streaming: Implementing WebSockets for live sentiment tracking during YouTube Premieres or Live Streams.
  • Trend Analysis Over Time: Plotting how viewer sentiment shifts day-by-day after a video is published.
  • Entity Recognition: Identifying which specific topics or people within the video are driving the positive or negative sentiment.

📬 Contact

Monu


If you liked this project, please consider leaving a ⭐ on this repository!

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages