Building a Live Subscribers Counter with NodeJs Scraping

Ever wondered how these Live Subscribers Counters websites are working?

It’s really nothing fancy 🤭.

And you can do it too, in just under 15 minutes.

📚 Let me show you how.

Breaking it down

Let’s look at it from a different perspective

What do you need in order to make a live counter of subscribers for a youtube channel?

  • A way to get the exact number of subscribers of a channel
  • A way to display it real time

In this tutorial I am going to cover mostly the way to get the number of subscribers of someone’s channel.

What are we going to use?

We are simply going to make use of NodeJs along with a few libraries like:

  • Request-Promise – For making requests to get the raw response of a youtube’s channel
  • Cheerio – For handling that raw response and parsing only what we want.
  • Another cool library 🔥- Which you can see if you check the youtube video.

All of these libraries can be easily installed with npm and don’t worry if you never heard of them, they are pretty straight forward to use.

How?

Since this is a Scraping Teaching kind of blog..

Of course, we are definitely NOT going to use the YouTube API for this project.

And now your inner voice probably goes:

“Why? this is stupid.”

And it it.

In a real production usage, this should not be the way to go. When you have API’s and good documentation, use them.

In this case we are using Scraping just for demonstration and learning purposes.

The process 💻

This project is something that you can easily do yourself if you follow along.

You can even watch the process and add more stuff on top of the code and make it more advanced.

So, without further non-sense talking..

Here is how I did it ✅.

Learning more 📚

Also if you want to learn more and go much more in-depth with the downloading of files, I have a great course with 7 hours of great content on Web Scraping with NodeJs.

1 thought on “Building a Live Subscribers Counter with NodeJs Scraping”

Leave a Comment