In this article, we’re going to look at extracting data from the YouTube Data API. For this, we need to setup an API key, which you can get via the Google Developer Console.
Now, you need to pick a channel to pull data from. In this case, I have taken the rapper Hopsin’s channel. To get the channel ID, you can right click on the channel page on YouTube and select ‘view source’. In there, if you do ctrl+f and search for channelid, you’ll be able to select the ID of that channel.
The next thing to do is extract the playlist_id_uploads field from the API response. This is the playlist for all videos that are uploaded to the channel.
So here, the dataframe called channel outputs the below:
And the dataframe called videos_list outputs the below.
Next, I take the list of videos on the channel and pass that into the request for video metadata. The output is shown below.
So there we have it, a super simple guide to querying the YouTube API.