How to scrape YouTube comments, replies included
Download every comment and reply of a YouTube video as JSON with one API call per page. Python, JavaScript and curl code, costs and pitfalls.
· 6 min read
YouTube comments are one of the most honest data sets on the internet. People tell creators what they liked, what confused them and what they want next, in their own words, thousands of times per video. Product teams mine them for feature requests, marketers for the language their audience uses, researchers for sentiment around a topic, and AI teams for training and evaluation data.
The official way to read them is the YouTube Data API: a Google Cloud project, an API key, a quota of 10,000 units per day and a commentThreads.list call that returns at most 100 threads at a time. It works, but the quota runs out quickly on a real project, and you still have to stitch threads, replies and pagination together yourself.
This guide shows a simpler route: one HTTP call per page that returns clean JSON, replies included, with no Google project. We will cover the request, the response fields, pagination, replies, cost, and the mistakes that make comment scrapers break.
What you get for each comment
The YouTube API of ScrapeCrate exposes comments at one endpoint:
GET https://api.scrapecrate.com/v1/youtube/videos/{video_id}/commentsEvery item of data is a top-level comment with these fields:
| Field | What it is |
|---|---|
comment_id | YouTube's ID of the comment |
text | The comment as written, emoji and line breaks kept |
author | The commenter's handle, for example @musicfan |
like_count | Likes on the comment |
reply_count | How many replies it has |
published_at | When it was posted (ISO 8601, UTC) |
is_pinned | True for the comment the creator pinned |
With include_replies=true each comment also gets a replies list whose items have comment_id, parent_id, text, author, like_count and published_at. The response also carries pagination (next_cursor, has_more) and meta (credits_used, credits_remaining, request_id), like every endpoint.
Your first request
Create a free account, copy your API key from the dashboard and pass it in the X-API-Key header. The video ID is the 11 characters after v= in the video URL (dQw4w9WgXcQ in https://www.youtube.com/watch?v=dQw4w9WgXcQ).
curl "https://api.scrapecrate.com/v1/youtube/videos/dQw4w9WgXcQ/comments?sort=new&limit=100" \
-H "X-API-Key: YOUR_API_KEY"sort is top (the default, YouTube's "Top comments") or new (newest first). limit goes from 1 to 500 and defaults to 50.
Which order should you pick? top is what a visitor sees first and is the right choice for "what do people think of this video". new is the right choice for monitoring: run it every day and stop as soon as you reach a comment you already stored.
Reading every comment: pagination
A popular video has tens of thousands of comments, more than one call returns. When there is more, the response says "has_more": true and gives a next_cursor. Pass it back as the cursor parameter, with the same other parameters, and repeat until has_more is false. Every page is a separate call.
The SDKs do the loop for you:
import csv
from scrapecrate import ScrapeCrate
client = ScrapeCrate(api_key="YOUR_API_KEY")
with open("comments.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.writer(f)
writer.writerow(["comment_id", "published_at", "author", "like_count", "reply_count", "text"])
for c in client.youtube.iterate("video_comments", video_id="dQw4w9WgXcQ", sort="new", limit=500):
writer.writerow([c["comment_id"], c["published_at"], c["author"], c["like_count"], c["reply_count"], c["text"]])Cursors are short-lived. If you pause a long export for too long you get a 410 cursor_expired error: start again from the first page (with sort=new, skip what you already have).
Getting the replies too
Replies often hold the real discussion: the creator answering a question, people correcting each other, the follow-up that explains a complaint. Ask for them with include_replies=true, and cap how many you want per comment with replies_per_comment (1 to 100, default 10):
curl "https://api.scrapecrate.com/v1/youtube/videos/dQw4w9WgXcQ/comments?limit=100&include_replies=true&replies_per_comment=20" \
-H "X-API-Key: YOUR_API_KEY"Compare reply_count with the length of replies to know whether a thread was cut by your replies_per_comment cap.
What it costs
Comments are priced by volume, not per request: 1 credit per 100 comments returned, replies included, with a minimum of 1 credit per call. A page of 500 comments costs 5 credits; 10,000 comments cost 100 credits, about $0.10 at the list price of $0.001 per credit. The free monthly allowance of 100 credits is enough to download 10,000 comments every month without paying anything.
Two details worth knowing:
With replies on, a call reserves
limit x (1 + replies_per_comment)items from your balance before it runs, then charges only what came back. Keeplimitandreplies_per_commentrealistic when your balance is low, or the call answers402 insufficient_creditseven though the real cost would have been small.Failed calls are never billed: a video that does not exist answers 404 and costs nothing.
The full price list of every API is on the pricing page.
Turning comments into insight
A CSV of comments is a starting point, not an answer. A few patterns that work well:
Questions as content ideas. Keep the comments that contain a question mark and sort them by
like_count: the most liked questions are what your audience wants explained next.Sentiment over time. Export with
sort=new, bucketpublished_atby day and run a sentiment model on each bucket. A drop right after an upload or a sponsor segment is easy to spot.Topic clusters for an LLM. Send the top 500 comments to a language model with "group these comments into themes and quote two examples per theme". It is a fast way to summarise a video's reception, and the comment IDs let you go back to the source. Our guide on web scraping for LLM and RAG pipelines shows how to combine comments with the video transcript.
Compare channels. List a competitor's latest uploads with the channel videos endpoint, then pull the top comments of each one: you will see which formats get the most engaged audience, not only the most views.
Common mistakes
Scraping the HTML page yourself. YouTube loads comments with internal API calls after the page renders, changes their format often and rate-limits datacenter IPs. A homemade scraper works for a week, then returns nothing. If you build one anyway, monitor the number of comments per run: zero is a bug, not a quiet video.
Forgetting that comment counts move.
comment_countof the video metadata endpoint includes replies and comments YouTube holds for review, so your total will rarely match it exactly.Treating authors as anonymous. Handles are personal data. Store them only if you need them, hash them if you only need to count unique commenters, and never publish them next to the text.
Ignoring
is_pinned. The pinned comment is written or chosen by the creator; exclude it from audience sentiment.
Beyond YouTube
The same account and the same credits work for the other sources people talk on: TikTok comments and transcripts, Reddit threads and reviews from Trustpilot, the app stores and Google Maps. If you are collecting opinions about a product, the reviews usually say what the comments only hint at.
Ready to try it? Create a free account, copy your key and run the first request above, or read the full parameter list in the YouTube API reference.
Frequently asked questions
Do I need a YouTube Data API key to scrape comments?
No. The comments come from the public video page, so there is no Google Cloud project, OAuth consent screen or daily quota of 10,000 units to manage. You only need a ScrapeCrate API key, and the first 100 credits of every month are free.
How many comments can I get from one video?
All the top-level comments YouTube shows publicly. One call returns up to 500 of them; follow pagination.next_cursor until has_more is false to read the rest. Videos with comments turned off return an empty list.
Can I get the replies to each comment?
Yes. Add include_replies=true and every comment carries a replies list, up to replies_per_comment (default 10, max 100). Replies are billed like comments.
How much does it cost to download 10,000 comments?
Comments are billed by volume, 1 credit per 100 comments returned (replies included), so 10,000 comments cost 100 credits, about 10 cents at the list price. Failed calls are never billed.
Is it legal to scrape YouTube comments?
Comments are public, but they are personal data in many jurisdictions. Collect only what you need, aggregate when you can, do not republish usernames next to the text, and read our guide on the legal side of scraping before you build a product on it.
Try it with free credits every month
One API key for every source in this guide. No card needed, and only successful calls are billed.