« YouTube Comments Data Scraper

YouTube API Channel Comments Scraper

Download Data to Excel & CSV Files

Steve Spagnola
Written by Steve Spagnola
Last updated March 27, 2022

Scrape YouTube Channel Comments Legally via Official API

While scraping comments by video is great if you have a single video of interest to you, it may be more helpful to scrape all the comments of an entire channel if you are working a more “niche” YouTube channel and want to get the comments from all videos for a particular channel.

To make this easy, we have the YouTube Channel Comments Integration on this page that works like the video comment endpoint in the previous section, but works with a YouTube Channel ID instead of a single Video ID. Just provide the Channel ID from the URL (e.g. the channel ID for this great channel https://www.youtube.com/channel/UCArmutk8nAbYQdaYzgqKOwA/ would be UCArmutk8nAbYQdaYzgqKOwA):

Channel ID to Scrape Comments From

Now execute the endpoint and you’ll want to take note of the videoID in the response - you’ll now get comments from a variety of videos within the same channel:

Channel Comments from All Videos

And just like in the previous section, you’ll also see up to 5 replies for each comment in the items > replies > comments section. To get more than the first 5 replies per comment, see the above section on scraping ALL the replies for comments.

Scraping ALL Comments

And just like before, we only get 100 comments per “page” (or response from the API endpoint). In order to get all of the comments for our channel, we need to “paginate” and get the next 100 comments and so on. We can either do this manually on the endpoint (look for the nextPageToken output and pass that in as the “Pagination Token”), or we can use the YouTube Channel Comments - Pagination workflow to automatically paginate for us. Just provide the Channel ID (or list of IDs) you want to scrape the comments of:

Enter in Channel IDs to Scrape Comments For

Run the workflow, and if your channel is somewhat small (say under 10K subscribers like mine), you’ll get back ALL the comments for ALL the videos in a few minutes:

All YouTube Channel Comments & Replies

This should be ALL of the root comments, but only the first 5 replies per comment. If you’re lucky enough to get more than 5 replies per comment, see below on how to ensure you scrape all the replies.

Scraping ALL Comment Replies

Once we have the output file YouTube_Channel_Comments.csv from the above workflow, we can now copy the items.id column to get a list of all the top-level Comment IDs in the channel we scraped, this way we can go through them all and scrape all of the comment replies. Just select the column as shown below:

Select the Comment IDs to Get All Replies

Now import the YouTube Comment Replies - Pagination workflow and this time you can paste in all of the Comment IDs (copied in the last step) into the workflow input, one comment ID per line (be sure to delete the items.id entry):

Enter a List of Comment IDs

Now when you run the workflow, it will make a request for every individual comment ID and get back all of the replies and combine them together. Keep in mind this will take a lot of requests (at least 947 plus pagination), so you may want to only run this for the top comments (most replies) of the channel you’re interested in.

💡 Related