Getting statistical insights using Pandas and the YouTube Data API
13 hours ago
Nowadays, there are more than 2.7 billion active YouTube users, and for many people, YouTube is not only entertainment but an important source of income. But how does it work? How many views or subscribers can different YouTube channels get? With the help of Python, Pandas, and the YouTube Data API, we can get some interesting insights.
This article will be divided into several parts:
Using the YouTube Data API. With this API, we will be able to get a list of YouTube channels for different search requests. For each channel, we will get information about the number of videos, views, and subscribers.Getting the list of channels we are interested in. This can be done only once.Collecting the channel data. To get statistical insights, we need to collect the data for some period of time.Data analysis.
Without further ado, let’s get into it.
1. YouTube Data API
First, a piece of good news for everyone who is interested in collecting data from large networks like YouTube: the YouTube API is free, and we don’t need to pay for it. To start using this API, we need two steps:
Open and create a new project. I already had an old project there, but after some period of inactivity, all its API limits were set to zeros, and I did not find a way to reset them. So, it’s just easier to make a new one.
Go to “APIs and Services” and enable “YouTube Data API”. Open the API, go to “Credentials,” and create an API key. If everything is done correctly, the Quotas page will look like this: