How to export YouTube comments and replies to CSV, without an API key or quota
By Hayden Barnett · · 5 min read
- YouTube
- Comments
- Python
YouTube has no export button for comments, not even for the channel that owns the video. The official route is the YouTube Data API’s commentThreads.list, which needs a Google Cloud project, an API key and a share of a daily quota. If you just want a video’s comments as rows in a spreadsheet, one GET returns the first page as JSON:
export FETCHPROOF_API_KEY=fp_live_xxx
curl -s "https://api.fetchproof.com/v1/youtube/video/comments?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ&order=top" \
--header "x-api-key: $FETCHPROOF_API_KEY"
url is the video’s watch URL, and it is the only required parameter. order is top or newest. The response is a page of top-level comments plus a continuationToken for the next page, and each comment carries its own token for its replies. The rest of this post turns that into a CSV with every reply, in Python, then in Node.
Why not the official API or a scraper library
The Data API works, and for an app that has to stay inside Google’s terms it is the right choice. The costs show up when the job grows:
- Setup. You need a Google Cloud project, the YouTube Data API enabled and a key before the first request.
- Quota. Google’s quota calculator lists
commentThreads.listat 1 unit per call, against a default of 10,000 units a day shared by every method except search and uploads. At most 100 threads come back per call, so a few large videos plus your other calls can use up the day. - Replies. A comment thread carries only some of its replies. Google’s comments guide sends you to a second method,
comments.list, for the full set, one paged call per thread.
Open-source tools such as youtube-comment-downloader and yt-dlp read the watch page directly and need no key. They are fine on a laptop. On a cloud server, YouTube is much less patient with datacenter IPs, and long runs tend to end in a bot check or HTTP 429. That is the same failure covered in the YouTube transcripts post. Those tools also give you likes as display text such as “38K”, so you have to parse them before you can sort.
The comments endpoint reads the public comment section for you and returns structured JSON. There is no Google project, no quota and no proxy pool. The credential is the Fetchproof key in x-api-key.
What comes back
Field names come from the published schema on the comments endpoint. The values below are placeholders.
{
"success": true,
"credits_remaining": 99,
"credits_charged": 1,
"comments": [
{
"id": "Ugz_xxx",
"content": "Example comment text",
"publishedTimeText": "3 months ago",
"publishedTime": "2026-09-03T12:00:00.000Z",
"replyLevel": 0,
"author": {
"name": "@example_viewer",
"channelId": "UC_xxx",
"isVerified": false,
"isCreator": false,
"avatarUrl": "https://yt3.ggpht.com/example",
"channelUrl": "https://www.youtube.com/@example_viewer"
},
"engagement": { "likes": 9300, "replies": 66 },
"repliesContinuationToken": "Eg0S_xxx"
}
],
"continuationToken": "Eg0S_yyy"
}
The fields that matter for an export:
engagement.likesandengagement.repliesare integers, so “9.3K” already arrives as a number you can sort.author.channelIdis the commenter’s stable ID.author.nameis the handle, which the person can change.isCreatormarks the video owner’s own comments.publishedTimeis an estimate. YouTube only shows relative ages such as “3 months ago”, and this field converts that text to a timestamp. KeeppublishedTimeTextnext to it, and don’t treat it as an exact posting time.repliesContinuationTokenis the key to that comment’s replies. It isnullwhen there are none.continuationTokenat the top level is the next page of comments. It isnullon the last page.
The endpoint’s published description is plain about the ceiling: about 1,000 comments in top order and about 7,000 in newest order. For a huge video, use newest to reach further back.
Python: every comment and reply, to CSV
The standard library is enough. Keep the key in the environment. The samples on this page use the placeholder fp_live_xxx.
import csv
import json
import os
import urllib.parse
import urllib.request
VIDEO = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
HEADERS = {"x-api-key": os.environ["FETCHPROOF_API_KEY"]}
def get(url):
request = urllib.request.Request(url, headers=HEADERS)
with urllib.request.urlopen(request, timeout=60) as response:
return json.load(response)
def comment_page(token=None):
url = "https://api.fetchproof.com/v1/youtube/video/comments?url=" + urllib.parse.quote(VIDEO, safe="") + "&order=newest"
if token:
url += "&continuationToken=" + urllib.parse.quote(token, safe="")
return get(url)
def replies(token):
while token:
body = get("https://api.fetchproof.com/v1/youtube/video/comment/replies?continuationToken=" + urllib.parse.quote(token, safe=""))
yield from body["comments"]
token = body.get("continuationToken")
def row(comment, parent_id=""):
return {
"id": comment["id"],
"parent_id": parent_id,
"author": comment["author"]["name"],
"channel_id": comment["author"]["channelId"],
"likes": comment["engagement"]["likes"],
"published": comment["publishedTime"],
"published_text": comment["publishedTimeText"],
"text": comment["content"],
}
rows, token = [], None
while True:
page = comment_page(token)
for comment in page["comments"]:
rows.append(row(comment))
for reply in replies(comment.get("repliesContinuationToken")):
rows.append(row(reply, parent_id=comment["id"]))
token = page.get("continuationToken")
if not token:
break
with open("comments.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=list(rows[0]) if rows else ["id"])
writer.writeheader()
writer.writerows(rows)
print(len(rows), "comments and replies written to comments.csv")
Each page of comments is one call, and so is each page of replies. Pass a continuationToken back unchanged and stop when it is null. On a later page the token carries the video and the sort, so url is only there to keep the request valid. urlopen raises on an error status, so a bad URL or a refused read stops the script instead of leaving a half-written file.
A video with comments turned off returns an empty comments list and a null token, so the script writes a header-only file. Open comments.csv in Excel or Google Sheets as UTF-8, because comments are full of emoji and non-Latin scripts.
To skip replies and keep the export cheap, delete the inner for reply loop. You can also call replies() only for comments whose engagement.replies is above a threshold.
Node: the top comments for a quick look
Node 18 and later include fetch. This version pulls the first page in top order and prints the most-liked comments, which is often all a content review or a sentiment prompt needs:
const video = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";
const response = await fetch(
`https://api.fetchproof.com/v1/youtube/video/comments?url=${encodeURIComponent(video)}&order=top`,
{ headers: { "x-api-key": process.env.FETCHPROOF_API_KEY } },
);
if (!response.ok) {
throw new Error(`YouTube comments failed: HTTP ${response.status}`);
}
const { comments, continuationToken } = await response.json();
for (const c of comments.toSorted((a, b) => b.engagement.likes - a.engagement.likes).slice(0, 10)) {
console.log(c.engagement.likes, c.author.name, c.content.slice(0, 80));
}
console.log(`next page: ${continuationToken ? "yes" : "none"}`);
toSorted needs Node 20. On Node 18, use [...comments].sort(...). If the comments feed a model, send content and engagement.likes only. The avatar and channel URLs add tokens without adding meaning.
From n8n or an MCP client
In n8n, the same x-api-key header is what the n8n HTTP Request post sets up once. Point the node at /v1/youtube/video/comments, pass url and order as query parameters, and use the node’s pagination option to send continuationToken back until it comes back empty. From an MCP client the tools are youtube_video_comments and youtube_video_comment_replies. Setup is in the MCP docs. An agent can then read a video’s comments next to its transcript and say what viewers pushed back on.
What a call costs
Each page of comments costs 1 credit, and so does each page of replies, as published on the comments and replies endpoints. A video with five pages of comments, where three threads each have one page of replies, comes to 8 credits. Errors, blocked or timed-out requests, invalid requests and cache hits cost nothing. A not-found or empty result is charged only where that operation’s published cost says so.
Read credits_charged on each response to see what that page cost. New accounts get 100 free credits, with no card. Pack sizes and prices are on the pricing page, and prepaid credits vs monthly subscriptions compares a one-time pack with a monthly quota. Every YouTube route is on the YouTube API page.
FAQ
Can I get YouTube comments without an API key?
Not from Google’s API, which needs a key for every commentThreads.list call. This endpoint needs only a Fetchproof key and reads the same public comments a logged-out visitor sees, with no Google Cloud project and no daily quota.
Does it include replies?
Yes, in a second call per thread. Each top-level comment has a repliesContinuationToken. Pass it to the replies endpoint as continuationToken, then follow that response’s own continuationToken until it is null. Replies have replyLevel 1 and an id that starts with the parent’s ID.
How many comments can I export from one video?
About 1,000 in top order and about 7,000 in newest order, per the endpoint’s published description. That covers most videos completely. On a very large one, newest reaches further back.
Can I get comments on a Short or a live stream replay?
Yes. Pass the video’s URL as url. A youtube.com/shorts/..., youtu.be/... or youtube.com/live/... link works as well as a watch URL, because each one carries the video ID. A video with comments turned off returns an empty list rather than an error.
Related guides and endpoints
Try it with 100 free credits
Sign up with an email address, no card. Credits never expire. Errors, invalid requests and cache hits cost 0 credits, and each endpoint page lists exactly what it charges.