Wulfcare Data guides

How to export YouTube comments to CSV

YouTube has no export button for comments. Here are three ways to get them into a CSV file that opens in Excel or Google Sheets. All three use the YouTube Comments Scraper, which needs no YouTube API key.

Without code

  1. Sign up for a free Apify account. The free plan includes $5 of credit a month.
  2. Open the scraper and paste your video URL into the input.
  3. Set the maximum comments per video (0 means all), and turn on replies if you want them.
  4. Click Start, then export the results as CSV.

With one command

Get your token under Settings → API & Integrations, then run:

curl -X POST "https://api.apify.com/v2/acts/wulfcare~youtube-comments-scraper/run-sync-get-dataset-items?format=csv&fields=videoId,author,comment,voteCount,replyCount,publishedAt,type&maxTotalChargeUsd=0.05" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"], "maxComments": 100, "sortCommentsBy": "TOP_COMMENTS"}' \
  -o comments.csv

With Python

import pandas as pd

df = pd.read_csv("comments.csv")
print(df.sort_values("voteCount", ascending=False).head(10))

Open CSV files with a real CSV parser. Comments can contain line breaks, so a 100-comment file can have more than 101 lines. That's normal.

What's in the file

Column What it is
comment The comment text
author The commenter's handle
voteCount Likes. YouTube rounds large numbers, such as 70K
replyCount Number of replies
publishedAt Approximate date, because YouTube only shows "3 days ago"
type comment or reply

Other columns include hasCreatorHeart, isPinned, isEdited, replyToCid, title and commentsCount, the video's exact comment total.

What it costs

$0.25 per 1,000 comments or replies, with no start fee, so 100 comments costs about 3 cents and 10,000 costs $2.50.

Can I use the official API instead?

Yes. If you have a Google Cloud project, commentThreads.list returns 1 to 100 comments per page and costs 1 unit a call out of your 10,000 daily units. That's plenty for many jobs, but you'll need to set up an API key, write the paging code and build the CSV yourself.

Comments can contain personal data such as names and handles, so make sure your use follows privacy laws like GDPR and YouTube's terms.