Youtube Comments Extraction and Sentiment Analysis Flask App – with source code – 2024

Hey guys in this blog we will implement Youtube Comments Extraction and Sentiment Analysis in Python using Flask. It is going to be a very interesting project. So without any further due, let’s do it…

YouTube is one of the most popular video-sharing platforms in the world, with over 2 billion monthly active users. As a result, it generates a massive amount of data in the form of comments, which can provide valuable insights into the user’s opinion about a particular video or topic. In this article, we will discuss a project on YouTube comments extraction and sentiment analysis using Python and Flask.

Snapshots of our App

Home Screen

Youtube Comments Extraction and Sentiment Analysis

Results Screen

Youtube Comments Extraction and Sentiment Analysis

Wordcloud

Youtube Comments Extraction and Sentiment Analysis - wordcloud

Technology Stack

  • Frontend – HTML and CSS
  • Backend – Flask(Python)

Working of our Youtube Comments Extraction and Sentiment Analysis App…

  • On the main page, we first enter/paste a youtube video url whose comments we need to analyze.
  • Then we click on the ‘Analyse Comments‘ button.
  • As soon as we hit the above button, our scrapper starts scraping comments from that video.
  • Now that we have a list of all the scraped comments, we will then clean these comments and run a sentiment analysis model on these cleaned comments.
  • A list of these cleaned comments along with their sentiment is sent on the results page.
  • All the POSITIVE sentiment comments have a green background, all NEGATIVE sentiment comments have a red background and all NEUTRAL comments have a gray background.
  • In the menu bar, we have a wordcloud option that will open up a wordcloud (as shown above) created accordingly from the scraped comments for a respective video.

Working Video of our App

Download Source Code

NOTE:

If you face a similar error as shown below visit this link and follow the first answer.

Youtube Comments Extraction and Sentiment Analysis

Error Handling

If your Chrome version and ChromeDriver version do not match and you see an error, you need to make the versions the same. Download the same versions of Chrome and ChromeDriver from the following links…

To degrade/upgrade your Chrome version in Linux run the following commands:

VERSION_STRING="114.0.5735.198-1"
wget "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${VERSION_STRING}_amd64.deb"
sudo dpkg -i "google-chrome-stable_${VERSION_STRING}_amd64.deb"
rm -i "google-chrome-stable_${VERSION_STRING}_amd64.deb"

So this is all for this blog folks. Thanks for reading it and I hope you are taking something with you after reading this and till the next time …

Read my last blog – Doctor-Patient Appointment System in Python using Flask

Check out my other machine learning projectsdeep learning projectscomputer vision projectsNLP projects, and Flask projects at machinelearningprojects.net.

Abhishek Sharma
Abhishek Sharma

Started my Data Science journey in my 2nd year of college and since then continuously into it because of the magical powers of ML and continuously doing projects in almost every domain of AI like ML, DL, CV, NLP.

Articles: 517

Leave a Reply

Your email address will not be published. Required fields are marked *