← vibhum aggarwal

youtube sentiment

read what a comment section actually feels

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.

A screenshot of the YouTube sentiment reader: a video sits labelled 'Warm — mostly positive, with some pushback. Based on 1,000 comments.' A −1 to +1 scale shows an average of +0.21 and a like-weighted score of +0.34. A split bar reads 51% positive, 28% neutral, 21% negative. A score distribution histogram follows, then two columns of the most-liked positive and negative comments.
what a result looks like, on a hypothetical video.

how to read it

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.

stepwhat it does
youtube_scraper.pypulls videos and comments into the database
sentiment_vader.pya score and a label for every comment
embed_comments.pya sentence embedding per comment
cluster_comments.pygroups them into topics, with representative examples
report.pysentiment 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.


← back