YouTube Video Comments
A YouTube video's metadata and its full comment thread.
0 rows in the dataset
Download the dataset
Get every row this scraper has collected as one CSV or JSONL file. If the data is older than maxAgeHours, the scraper is re-run with its configured settings first. The key needs the datasets:export scope.
DOWNLOAD_ID=$(curl -s -X POST "https://api.pandorlabs.com/v1/datasets/youtube-comments/downloads" \ -H "Authorization: Bearer $PANDORLABS_KEY" \ -H "Content-Type: application/json" \ -d '{"maxAgeHours":24,"format":"csv"}' | jq -r '.id')while true; do STATUS=$(curl -s "https://api.pandorlabs.com/v1/downloads/$DOWNLOAD_ID" \ -H "Authorization: Bearer $PANDORLABS_KEY" | jq -r '.status') [ "$STATUS" != "refreshing" ] && break sleep 5donecurl -s "https://api.pandorlabs.com/v1/downloads/$DOWNLOAD_ID/file" \ -H "Authorization: Bearer $PANDORLABS_KEY" \ -o dataset.csvThe rate is 1 credit per 100 rows cached and 2 credits live, charged on the rows in the dataset when the download becomes ready. A failed refresh is not charged. The file stays downloadable for 24 hours. See pricing.
Start a run
To choose the targets yourself, send the parameters below as input. The call returns 202 with the run; the key needs the scrapers:run scope and the account a positive credit balance.
curl -X POST "https://api.pandorlabs.com/v1/scrapers/youtube-comments/runs" \ -H "Authorization: Bearer $PANDORLABS_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": { "videoIds": [ "dQw4w9WgXcQ", "https://youtu.be/…" ], "maxCommentsPerVideo": 500, "includeReplies": false, "maxThreadsWithReplies": 25 } }'A run is billed at the live rate once it finishes: 2 credits per 100 rows it collected. A run that collects nothing costs nothing.
Parameters
Every parameter is optional. Anything you leave out uses the default shown here; an unknown name or an invalid value is rejected with a 400 that lists each problem.
Targeting
videoIdsstring[]
Videos
Ids or any YouTube URL — watch, youtu.be, /shorts/ and /live/ are all accepted.
- Default
- none
- Example
dQw4w9WgXcQ, https://youtu.be/…
Collection
maxCommentsPerVideonumber
Max comments per video
Roughly 20 per request. Comments are stored on the video document, which Mongo caps at 16MB.
- Default
500- Range
- 1 to 5000
includeRepliesboolean
Collect replies
Costs one extra request per thread — the single most expensive option here.
- Default
false
maxThreadsWithRepliesnumber
Threads to open replies for
Only applies when replies are collected. Threads are opened in the order YouTube ranks them.
- Default
25- Range
- 1 to 500
maxRepliesPerThreadnumber
Max replies per thread
- Default
50- Range
- 1 to 500
concurrencynumber
Concurrent videos
- Default
3- Range
- 1 to 10
requestDelayMsnumber
Delay between requests (ms)
- Default
500- Range
- 0 to 30000
Input as JSON Schema
The same schema the API validates against. Use it as a tool input schema or to generate a typed client.
{ "type": "object", "additionalProperties": false, "properties": { "videoIds": { "type": "array", "items": { "type": "string" }, "maxItems": 1000, "title": "Videos", "description": "Ids or any YouTube URL — watch, youtu.be, /shorts/ and /live/ are all accepted.", "default": [], "examples": [ "dQw4w9WgXcQ, https://youtu.be/…" ] }, "maxCommentsPerVideo": { "type": "number", "minimum": 1, "maximum": 5000, "title": "Max comments per video", "description": "Roughly 20 per request. Comments are stored on the video document, which Mongo caps at 16MB.", "default": 500 }, "includeReplies": { "type": "boolean", "title": "Collect replies", "description": "Costs one extra request per thread — the single most expensive option here.", "default": false }, "maxThreadsWithReplies": { "type": "number", "minimum": 1, "maximum": 500, "title": "Threads to open replies for", "description": "Only applies when replies are collected. Threads are opened in the order YouTube ranks them.", "default": 25 }, "maxRepliesPerThread": { "type": "number", "minimum": 1, "maximum": 500, "title": "Max replies per thread", "default": 50 }, "concurrency": { "type": "number", "minimum": 1, "maximum": 10, "title": "Concurrent videos", "default": 3 }, "requestDelayMs": { "type": "number", "minimum": 0, "maximum": 30000, "title": "Delay between requests (ms)", "default": 500 } }}Run, poll, read rows
The run is asynchronous. Poll it until it reaches a terminal status and its billing is paid, then page through its rows. Until then the rows endpoint answers 409 (still queued or running) or 402 (payment required).
RUN_ID=$(curl -s -X POST "https://api.pandorlabs.com/v1/scrapers/youtube-comments/runs" \ -H "Authorization: Bearer $PANDORLABS_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": { "videoIds": [ "dQw4w9WgXcQ", "https://youtu.be/…" ], "maxCommentsPerVideo": 500, "includeReplies": false, "maxThreadsWithReplies": 25 } }' | jq -r '.id')while true; do RUN=$(curl -s "https://api.pandorlabs.com/v1/runs/$RUN_ID" \ -H "Authorization: Bearer $PANDORLABS_KEY") STATUS=$(echo "$RUN" | jq -r '.status') BILLING=$(echo "$RUN" | jq -r '.billing.status') case "$STATUS" in queued|running) ;; *) [ "$BILLING" != "pending" ] && break ;; esac sleep 5doneecho "$RUN" | jq '{status, rowCount, billing}'curl -s "https://api.pandorlabs.com/v1/runs/$RUN_ID/rows?page=1&limit=100" \ -H "Authorization: Bearer $PANDORLABS_KEY"See the API reference for pagination, cancelling and listing runs.
Output fields
Rows have no fixed schema; these are the fields observed in the rows collected so far. Coverage is the share of rows where the field is present.
No rows collected yet, so no fields have been observed. Run the scraper once and they will appear here.
