Geonode Community

Johnny J. O'Donnell
Johnny J. O'Donnell

Posted on

Master the Art of Scraping: A Step-by-Step Tutorial to Extracting YouTube Comments with

Analyzing the sentiment of YouTube comments can reveal a wealth of insights about public perception and engagement towards video content. I recently embarked on this journey using MonkeyLearn, a formidable tool in the text analysis domain. Here's a comprehensive guide, step-by-step, to walk you through how I accomplished this task.

Scraping YouTube Comments

First things first, collecting the YouTube comments was my initial step. To achieve this, I turned to some powerful web scraping tools. Although programming prowess can come in handy here, several user-friendly options do not require a line of code! Among them, stood out due to its straightforward point-and-click functionality, which made capturing the needed data a breeze.

Choices at Hand

Visual Scraping Tools

  • ParseHub: Known for its simplicity, ParseHub guided me through customizing my scraper, which was free to use and allowed downloading the results in Excel or JSON.
  • The direct integration with MonkeyLearn saved me an extra step, making the entire process smoother.

For the Coders

  • If you're inclined towards coding, tools like Scrapy for Python can offer more flexibility and control over your scraping process.

Cleansing the Data

With the comments in hand, the next critical step was cleaning the data, as the scraped comments often include unwanted text, emojis, URLs, and more. I aimed to remove these elements to ensure the analysis was focused solely on the text that could accurately reflect sentiments.

Strategies I Adopted

  • Removing unnecessary punctuation, special characters, and emojis to avoid processing issues.
  • Converting all text to lowercase to maintain uniformity.

Breaking Down the Data into Analyzable Units

Given that a single comment can express multiple sentiments, I used MonkeyLearn's opinion unit extractor. This helped in dissecting comments into smaller parts, ensuring that each sentiment expressed could be accurately captured and analyzed.

Analyzing the Sentiment

MonkeyLearn shines in its ability to classify text into positive, negative, or neutral sentiments. By feeding the cleaned and segmented comments into MonkeyLearn's pre-trained sentiment analyzer, I started to see the emotions behind the words unfold.

Fine-Tuning the Analysis

While MonkeyLearn's pre-built models are quite robust, I took an extra step to train a custom model. This involved manually tagging a subset of the comments according to their sentiment, which, in turn, allowed the model to learn from my specific dataset.

Visualizing the Results

Lastly, the profound part of this journey was visualizing the analysis results. MonkeyLearn Studio provided an intuitive interface to bring together my analyses and present them in an easily digestible format. The word cloud feature, highlighting commonly used words, and the sentiment trend over time offered profound insights into the public perception of the video content.


The process of sentiment analysis on YouTube comments, while may seem intricate at first glance, is quite approachable with tools like MonkeyLearn and By following a structured approach – from scraping and cleaning the data to analyzing sentiments and visualizing the results – I uncovered valuable insights that went beyond mere numbers. Whether it's gauging public sentiment, understanding engagement, or simply exploring the emotions behind the text, the combined power of web scraping and machine learning tools opens up a new realm of possibilities for content creators and marketers alike.

This practical experience has not only enriched my understanding of sentiment analysis but also demonstrated the potency of accessible AI tools in transforming raw data into meaningful stories.

Top comments (0)