Querying YouTube Video Statistics Using Python

Using Python and the YouTube API you can query and store a channel’s video statistics. Using either the video ID or the channel ID you can retrieve a host of information from YouTube.

This is a brief outline of my approach. I’ll be expanding on the steps in the near future. I used two scripts to do this.

The first one checks for new videos from a channel in specific time range (this time can be set. It writes ID, title, date, and duration into a spreadsheet. I used Google Sheets and Python to do this.

The second part uses uses Python to iterate through the spreadsheet I mentioned in the first script on a daily basis and checks the video ID for updated statistics. I pull the view count at various intervals (such as 1 week after the video was posted, 1 month, etc.) and when those dates occur, a column in the spreadsheet will be uploaded with how many views that video currently has.

I will be uploading the scripts to GitHub shortly.

Leave a Reply

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