Diving into YouTube Analytics
Deepnote presented a live stream featuring a showcase of how to use Google's YouTube API. We had a few Deepnote coders and a Deepnote user Allan who helped crack the API and start getting data. Below is a project inspired from that stream!
In this notebook we are going to dive in and check out the popular YouTube channel Good Mythical Morning.
Want the data without making the API calls? GMM data csv can be downloaded here. Github
Imports
In this section we are going to import our libraries.
Setup
First you will need to create an API key by going to API signup. Then I created an enviroment variable in Deepnote by selecting integrations on the side menu. Call it whatever you would like and paste in your key. Now we can grab our API key out of our Deepnote integration and setup our youtube variable.
API Functions
In this section we setup some API functions to help us gather data. We create a function to gather channel stats and video stats. To do this in a effecient way and save API calls we do not use the search function. We pull in GMM's upload playlist ( containing all of their videos ) and use that to build a video list. Then grab the data from each video.
Create our Channel Stats
Find our Upload Playlist ( will contain all video uploads )
Get our Video List
Get our Video Details
Finally we will get all of our videos details returned in a dictionary.
Creating Visualizations
In this section we will covert our data to pandas dataframe and start visualizing. I have also created a CSV of data in the cell below if you don't want to do the API calls yourself.