homeprojectsblogcredentialsusesaboutcontact
projects/yt-sentiment-analyzer
PythonLightGBMFastAPINLPChrome ExtensionDocker

YouTube Comment Sentiment Analyzer

Full-stack app that analyzes sentiment of YouTube video comments using a custom-trained LightGBM model exposed via FastAPI, paired with a Chrome Extension for on-the-fly analysis directly from the browser.

GitHub ↗
Accuracy: 79.96%F1: 0.808,869 comments/sec0.11 ms/comment
Overall Accuracy
79.96%
Macro F1-Score
80%
Positive Precision
91%
Negative Recall
80%
8,869Throughputcomments / sec
5.63sPipeline Timefor 50k comments
0.11msAvg Latencyper comment
49,985Test Setlabeled comments

YouTube comment sections contain thousands of unstructured opinions with no easy way to gauge overall sentiment. Manual review is impossible at scale, especially for viral videos with hundreds of thousands of comments.

Trained a LightGBM model with TF-IDF vectorizers on labeled comment data to classify text as Positive, Negative, or Neutral. Built a FastAPI backend that retrieves all video comments via the YouTube Data API with exponential backoff pagination. Packaged a Chrome Extension (Manifest v3) that provides an in-browser popup dashboard with visual breakdowns, month-by-month trends, and highlighted top comments. The backend is Dockerized for easy deployment.

PythonLightGBMScikit-Learn (TF-IDF)FastAPIYouTube Data API v3Chrome Extension (Manifest v3)DockerHTML/CSS/JS
  • Overall accuracy of 79.96% on 49,985 labeled comments
  • Macro F1-Score of 0.80 with Positive Precision at 0.91 and Negative Recall at 0.80
  • Throughput of ~8,869 comments processed per second
  • Total pipeline time of 5.63 seconds for 50,000 comments
  • Average latency of 0.11 ms per comment - capable of scaling to viral videos
  • Chrome Extension dashboard with month-by-month sentiment trends and highlighted top comments
  • Docker containerized backend for one-command deployment
  • 01LightGBM with TF-IDF is surprisingly competitive with transformer-based models at a fraction of the inference cost - throughput is the key differentiator
  • 02YouTube Data API pagination requires exponential backoff to reliably fetch all comments for large videos without hitting rate limits
  • 03Chrome Extension Manifest v3 has stricter service-worker constraints than v2; background scripts need complete refactoring
  • 04Dockerizing a FastAPI app is straightforward but environment variable injection for secrets (API keys) requires careful Dockerfile + docker-run design
← Back to projects