This tutorial explains how to download all comments from any YouTube video. To do this here I will mention a simple script that uses YouTube API to download comments in on your PC. Basically the script gets all the comments from any given YouTube video and then save them in a JSON file. You can then open that file in Excel or convert to other formats such as CSV with ease. The script is simple and only takes YouTube ID and output file name from you and then does its job automatically.
Quite some time ago we cover order online YouTube comment downloader. But that does not seem to be working right now, so I am introducing this new script here. It works very efficiently as it replicates the original YouTube API calls to scrape the data from them the comments on your computer. And there is no login or something like that is required in order to make it work. All you need is Python and you can run it on Windows, Mac, and Linux PC. You can see the progress of downloading comments on the terminal window. And when it is done, you can explore the output file.
How to Download all Comments from any YouTube Videos?
Getting started with this script is very simple. You just need Python2 installed on your computer. If you don’t have Python already then you can download it from here. After that, you run the following command to set up some dependencies. After this, you are ready to use the script.
pip2 install requests lxml cssselect
Simply clone it from its GitHub repository using the git command. Or, you can download the zip file manually. Find the “downloader.py” file and then make sure that the terminal or the command prompt pointing to the current directory. After that, you just run the following command and then it will start downloading comments. You just have to specify the YouTube video ID and name of the output file. This is as simple as that.
Syntax: python2 downloader.py --youtubeid YT_ID --output FileName Example: python2 downloader.py --youtubeid 11URhPthsk4 --output ilfs.json
In the above screenshot, you can see how this simple command line script to download comments from any YouTube video. And it downloads all the comments in a JSON file. You can later use that file however you want. There are some online as well software to convert JSON file to CSV and other spreadsheet formats. You can make use of those software, if you want the data in another format.
Closing words:
The problem with the traditional is scraping is that it takes a lot of time. But the script that I have mentioned here does smart work by replicating the actual AJAX requests that YouTube uses behind the scene to render comments. With this, you can get thousands of comments on your PC from any YouTube video in just few seconds. I really liked the functionality of the Script and you can use it very easily as well.