youtube sentiment
scrolling a comment section for a minute gets you an impression. this reads all of them and tells you whether that impression is right. it pulls up to a thousand top-level comments, scores each with VADER (which handles emphasis, slang and emoji — not bad doesn't become bad), and shows you the shape of the reaction: not just an average, but whether the room is warm, split, or quietly negative under a few loud positive replies. the most-liked positive and negative comments sit side by side, which is usually where the real story is.
how to read it
- warm / split / quietly negative — a one-line summary of the mood, from the average score.
- average vs like-weighted — the hollow dot is the plain average, the blue tick weights each comment by its likes. when they're far apart, a small loud group is pulling the vibe one way.
- the split bar — how many comments fall in each of positive, neutral and negative.
- the distribution — the shape matters. a wall at zero means polite neutrality; two humps mean the room is divided; a long tail means a few people are really heated.
- most-liked, side by side — the top positive and negative comments people actually agreed with. usually where the real story is.
run it yourself
the code is on github. the web version needs a free YouTube Data API v3 key (10,000 units per day, enough for ~500 analyses):
git clone https://github.com/vibhumaggarwal/youtube-sentiment.git
cd youtube-sentiment/web
npm install
echo "YOUTUBE_API_KEY=your-key-here" > .env.local
npm run dev
open http://localhost:3000, paste any YouTube link — watch, youtu.be or
Shorts — and it reads the room.
the longer-running pipeline
the python version keeps everything in a local sqlite file and only processes new rows, so it can be re-run safely and picks up where it stopped when the daily quota runs out. on top of VADER it embeds each comment with a sentence transformer and clusters them, so instead of one sentiment number you get the handful of distinct opinions people keep returning to — the topics, not just the mood.
| step | what it does |
|---|---|
youtube_scraper.py | pulls videos and comments into the database |
sentiment_vader.py | a score and a label for every comment |
embed_comments.py | a sentence embedding per comment |
cluster_comments.py | groups them into topics, with representative examples |
report.py | sentiment by city, by topic, and the extremes people liked most |
i originally pointed it at "life in ___" videos for Bangalore, Delhi and Mumbai, to see whether the comment sections of a city agree with each other about living there.