Scrape YouTube Channels & Details
If you make or monitor content on YouTube, you may be looking to track key metrics for YouTube channels that are relevant to your businesses. While there are plenty of “screen scrapers” that attempt to unofficially scrape this data from the YouTube website, we’ll discuss how to achieve this using the official YouTube Data API, which is available to all Google users at no cost.
In order to scrape & monitor YouTube channels, you simply need to gather a list of Channel IDs. You can get these from the YouTube channel page from the URL. E.g. if you visit the page here: https://www.youtube.com/channel/UCArmutk8nAbYQdaYzgqKOwA
you’ll see from the URL that the Channel ID is UCArmutk8nAbYQdaYzgqKOwA
.
If the URL looks different, e.g. contains the username like https://www.youtube.com/c/StevesieData
- you can get the Channel ID by clicking into one of the videos, and then from the video watch page click on the channel name to navigate to the URL with the Channel ID in it.
Using the YouTube Data API
In order to use the YouTube API, you need to get an API key. But don’t worry, this is very easy and free - we have an article here describing how to get your YouTube API key.
Once you have an API key, you’ll want to refer to the YouTube Channels List Endpoint where you can provide a single Channel ID and your API key to get back details about the channel. The data you get back (and how many YouTube API credits you consume) will depend on what you provide under the part
parameter.
Channel Stats
In order to get the channel statistics back, you want to make sure you include statistics
in the part
parameter and you’ll get back the following numbers:
- Total Channel View Count
- Subscriber Count
- Video Count
Channel Topics
You can also get back a list of topics for any channel by providing the topicDetails
value for the part
parameter. Note that you can combine these, so to get back both stats and topics you can provide statistics,topicDetails
in the part
parameter.
The response data is a little strange, below is what it looks like when scraping with the Channel Details lookup on this page (green box):
You’ll see the Topic IDs are not human-readable, but rather IDs used to identify topics the channel is about. You can use these to Scrape YouTube Search Results and find similar channels with these topics. The topicCategories
part of the response is presumably the human readable equivalent of the encoded topics you can reference for your personal enjoyment.
Other Response Data
You’ll see other fields returned too, like the channel name, country, description, banner artwork URL, etc… just refer to the Channel Response Data Documentation from the YouTube API. You just want to add snippet
to your list of items in your part
parameter, so to get all of the data back we’ve discussed so far, your part value should be snippet,statistics,topicDetails
.
Bulk Scraping With Stevesie
If you have a list of Channel IDs you’d like to process and just need the data back as a CSV file, you can use the Multiple YouTube Channel ID Lookup Workflow on the Stevesie Data platform (please note this is a paid service). This will allow you to enter a list of Channel IDs and collect the data back as a CSV file. You can also schedule the workflow to run periodically on an automated basis to track how different channels are performing.