This webpage presents information about getting the most common words or topic from YouTube comments either in a specific video or in a specific channel.
In order to be able to extract the comments from a YouTube video, five things are needed (three required, two optional):
Where do I find the video id?
Let's assume you have the following YouTube video link:
The text in red represents your video id. The video id will always be found after the equals sign (=).
Where do I find the channel id? (Only needed when downloading comments from all videos)
Let's assume you have the following YouTube channel link:
The text in red represents your channel id; however, sometimes the channel id is not included in the link.
For example, if you have a link similar to the following:
You only have the user's username, not even the channel name or title.
In this case, you will have to right click anywhere on the webpage and select "View Source" or "View Page Source" (depending on the browser you are using). Once you have the source code displayed on your screen, search for the keyword "channelId" and you will find your channel id inside the "content" tag.
How can I install the LXML and the CSS SELECT libraries for Python?
Before attempting to install the libraries, you need to make sure the libraries were not already pre-installed when you installed Python.
Go to the directory where the Python files are located, it usually is in this path: C:\Python34\Scripts
In your PC, search Command Prompt
Try typing the following in the Command Prompt:
If for some reason you got an error, try updating the library that failed to be installed only:
If the "requests" library was not installed:
If the "lxml" library was not installed:
If the "cssselect" library was not installed:
If you did not get any errors after updating the libraries, you can proceed to create the YouTube API key using these instructions; otherwise, you will have to install the libraries individually.
Once you have downloaded and installed Python with all of its required libraries, and you have created your YouTube API key (if you needed it), the last thing to do will be to run the script.
The script YT_common_topic will simply retrieve the comments from a specific video. I got the original code from this website, I just simply combined them and modified some parts of the code to make it more user friendly for users who have no prior experience in programming.
You can download the scripts here
The script will create a new folder named "results" and it will store all of the comments or questions and the common words or topics in two different text files.
The script YT_all_common_topics will retrieve all the comments from a specific channel. I got the original code from this website and also from this website, I just simply combined them and modified some parts of the code to make it more user friendly for users who have no prior experience in programming.
You can download the scripts here
The script will create three new folders named "playlists," "comments," and "statistics."
In the folder "playlists," the script will store each playlist data in a separate text file.
In the folder "comments," the script will store all of the comments or questions and the common words or topics in two different text files.
In the folder "statistics," the script will store data about the videos in separate text files. This includes the lists of the most viewed, the most liked, the most disliked, and the most commented videos in descending order.