logo
languageENdown
menu

Export YouTube Comments With 3 Quick Methods

5 min read

Want to export all comments from a YouTube video? This guide shows you the three easiest ways to get YouTube comments, with and without coding.

You’ll learn how to quickly download YouTube comment data for sentiment analysis, research, or machine learning, no scraping experience required.

Generally, yes — scraping publicly available YouTube comments for research or analysis is legal, as long as you respect YouTube’s Terms of Service and avoid collecting personal or private information.

Legal experts and court rulings, such as hiQ Labs v. LinkedIn (2022), have affirmed that accessing public web data does not violate anti-hacking laws when done ethically and responsibly. In other words, extracting publicly visible comments for sentiment analysis or academic study is permissible.

Check out our detail guide that walk thourgh most countrys’ laws about web scraping:

is web scraping legal

The thing is, manually copying thousands of comments is just not practical. That’s why most people would use web scrapers to do so. You tell them what you need, and in minutes, all those comments are sitting in a tidy spreadsheet.

Free YouTube Comments Scraper With Code and Without Coding

The previous section was essential to help you understand that YouTube comments scraping is legal. Here we’ll talk about how to get the comments easily online, with coding, and with the best YouTube comment scraper – Octoparse.

Method 1: Export Youtube Comments Online

Octoparse’s YouTube comment scraper allows you to enter up to 10,000 URLs at once, meaning you can export up to ten thousand YouTube video comments simultaneously.

You don’t need to download anything. Just try the YouTube details and comments scraper directly by entering the youtube URL.

Here I tested one viral youtube video with 456 comments on it:

What I love about Octoparse’s online template is that it contains a rich set of data types that I can analyze from the youtube video, such as how many likes one comment has, who left the comment, the date, and etc.

It can also export the comments nicely into spreadsheet:

Well, no more needed to be said here, it’s free and you don’t need to download anything. If you want to see what more it can do, feel free try it yourself:

https://www.octoparse.com/template/youtube-details-comments-scraper

Method 2: Scrape YouTube Comments With Octoparse

Octoparse’s online template is powerful, but they are merely one small part of what Octoparse can do. When you encounter different scenarios like IP blocks and so on, you might need a more comprehensive approach.

Step 1: Paste the YouTube URL to Octoparse

Before beginning, you need to download and install Octoparse on your device, and sign up for a free account.

Copy and paste your desired YouTube video URL in the search bar, and click on the Start button. Octoparse will load the page by auto-detecting.

scrape youtube comments with Octoparse

You can also search YouTube comments on the search bar and find the preset template from method 1.

Step 2: Customize YouTube comment scraping workflow

Octoparse will automatically create a YouTube comments crawler for you.

You can make changes with the Tips it given to check all data you want can be found in the preview table. You can quickly delete any fields that you do not wish to scrape or rename.

Step 3: Scrape YouTube comments and download

Click the Save button in the upper-right corner to save the task you created in Octoparse. After that, hit the Run button and wait until Octoparse finishes its job. You can download the scraped YouTube comments in your desired format.

You can also scrape other information from YouTube channel, reading this article: How to Build A YouTube Channel Crawler, or watching the video guide below to learn more details.

Video guide to scrape YouTube video info with Octoparse

Method 3: Scrape YouTube Comments with Python

Python scripts provide another powerful way to scrape YouTube comments. But, this method is complex if you do not have computer programming experience.

Note: Make sure you have a Python environment setup on your computer before proceeding with this method.

How to scrape YouTube comments using Python programming language

Step 1: Install Google Chrome on your computer.

Step 2: Once done, install the ChromeDriver by clicking here.

Step 3: In your Python code, import the following libraries needed to perform YouTube comments data scraping.

import time
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

These libraries are needed to crawl through YouTube comments that are dynamically loaded. Don’t worry if you don’t know precisely the purpose of every library used in the process.

Step 4: Add the below code to scrape YouTube video comments.

data= []
youtube_video_url= "https://www.youtube.com/watch?v=kuhhT_cBtFU&t=2s"

with Chrome(executable_path=r'C:\Program Files\chromedriver.exe') as driver:
    wait = WebDriverWait(driver,15)
    driver.get(youtube_video_url)
 
   for item in range(200):
        wait.until(EC.visibility_of_element_located((By.TAG_NAME, "body"))).send_keys(Keys.END)
        time.sleep(15)


    for comment in wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, "#content"))):
        data.append(comment.text)

Here, you have created a Python loop that will loop through the comments of your YouTube video and, during each iteration, append the scraped comments in the data field. Also, change the YouTube video link to your desired video from the youtube_video_url variable.

Step 5: Visualize the scraped YouTube comments using Python’s Pandas library. You need to add the following lines of code at the end of your python file.

import pandas as pd
df = pd.DataFrame(data, columns=['comment']
df.head()

Final Thoughts

Now, you have learned how to export all YouTube comments with both coding and no-coding. The first is to use Octoparse‘s free online youtube comment scraper, and the second is by using Octoparse and design a workflow yourself, the last one is by using a Python script. However, you need to have some programming skills to scrape YouTube comments with Python.

Choose the one which can meet your needs better. If you want to check out Octoparse, feel free to sign up an acount and try the 14 days free trial:

Turn website data into structured Excel, CSV, Google Sheets, and your database directly.

Scrape data easily with auto-detecting functions, no coding skills are required.

Preset scraping templates for hot websites to get data in clicks.

Never get blocked with IP proxies and advanced API.

Cloud service to schedule data scraping at any time you want.

FAQs

1. How many data fields should I export from YouTube comments?

I recommned starting with the basics: author, author URL, comment text, date, and like count. Add replies, sentiment, and language only if you need deeper analysis.

2. Do I need to code to export YouTube comments?

Not necessarily. There are easy no-code scraper templates that you can find in Octoparse and free web scrapers online, plus a Python option if you want more customization.

Pick what fits your comfort level and volume.

3. What challenges should I expect and how can I mitigate them?

Expect dynamic loading and possible IP blocks.

I suggest you use tools with good pagination support, pace requests sensibly, and have a fallback (API or alternate method) if scraping runs into trouble.

That’s why I recommend Octoparse. It covers the full range: no-code online templates, no-code desktop workflows, with built-in pagination and sensible pacing, basically act as a human browsing a website. It also offers IP rotation and other anti-blocking features such as CAPTCHA solvers, plus export options if it runs into obstacles.

Get Web Data in Clicks
Easily scrape data from any website without coding.
Free Download

Hot posts

Explore topics

image
Get web automation tips right into your inbox
Subscribe to get Octoparse monthly newsletters about web scraping solutions, product updates, etc.

Get started with Octoparse today

Free Download

Related Articles