YouTube comment replies API
Replies to one comment.
GET /v1/youtube/video/comment/replies
GET /v1/youtube/video/comment/replies
Replies to one comment. Pass the comment's replies cursor from the comments list as cursor The cursor alone is enough (ScrapeCreators' continuationToken); the handler rejects a call with no cursor.
- Cost: 1 credit
- Cache: Results are kept up to 30 days; send
max_age_daysto reuse them for free. - Timeout: A request still running after about 25 seconds answers
202with a job to poll (Batch and jobs).
Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
url | URL | no | Video or Short URL (watch, youtu.be, shorts, live, embed). Accepted hosts: youtube.com, youtu.be. |
id | string | no | 11-character video id. Also accepted as videoId, video_id. |
comment_id | string | no | Id of the parent comment. Also accepted as commentId. |
Every request also accepts:
cursor: the cursor from the previous page (Pagination).trim:truefor a smaller response withoutnullfields andextra.raw:trueto also get the platform's original object asraw.max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).
Example request#
Set your key in the environment first (see Authentication).
1curl -G "https://api.socialscrape.dev/v1/youtube/video/comment/replies" \2 -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3 --data-urlencode "id=dQw4w9WgXcQ" \4 --data-urlencode "comment_id=UgwPwTibxdgqCHZxktd4AaABAg" \5 --data-urlencode "cursor=Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd3UHdUaWJ4ZGdxQ0haeGt0ZDRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3dQd1RpYnhkZ3FDSFp4a3RkNEFhQUJBZw%3D%3D"1import os2import requests34params = {5 "id": "dQw4w9WgXcQ",6 "comment_id": "UgwPwTibxdgqCHZxktd4AaABAg",7 "cursor": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd3UHdUaWJ4ZGdxQ0haeGt0ZDRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3dQd1RpYnhkZ3FDSFp4a3RkNEFhQUJBZw%3D%3D",8}9res = requests.get(10 "https://api.socialscrape.dev/v1/youtube/video/comment/replies",11 headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},12 params=params,13)14body = res.json()1516if body["ok"]:17 print(body["data"])18else:19 print(body["error"]["code"], body["error"]["message"])1const url = new URL("https://api.socialscrape.dev/v1/youtube/video/comment/replies");2url.search = new URLSearchParams({3 "id": "dQw4w9WgXcQ",4 "comment_id": "UgwPwTibxdgqCHZxktd4AaABAg",5 "cursor": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd3UHdUaWJ4ZGdxQ0haeGt0ZDRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3dQd1RpYnhkZ3FDSFp4a3RkNEFhQUJBZw%3D%3D"6}).toString();7const res = await fetch(url, {8 headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },9});10const body = await res.json();1112if (body.ok) {13 console.log(body.data);14} else {15 console.error(body.error.code, body.error.message);16}1{2 "nodes": [3 {4 "name": "SocialScrape YouTube comment replies",5 "type": "n8n-nodes-base.httpRequest",6 "typeVersion": 4.2,7 "position": [8 0,9 010 ],11 "parameters": {12 "method": "GET",13 "url": "https://api.socialscrape.dev/v1/youtube/video/comment/replies",14 "sendQuery": true,15 "queryParameters": {16 "parameters": [17 {18 "name": "id",19 "value": "dQw4w9WgXcQ"20 },21 {22 "name": "comment_id",23 "value": "UgwPwTibxdgqCHZxktd4AaABAg"24 },25 {26 "name": "cursor",27 "value": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd3UHdUaWJ4ZGdxQ0haeGt0ZDRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3dQd1RpYnhkZ3FDSFp4a3RkNEFhQUJBZw%3D%3D"28 }29 ]30 },31 "sendHeaders": true,32 "headerParameters": {33 "parameters": [34 {35 "name": "x-api-key",36 "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"37 }38 ]39 }40 }41 }42 ],43 "connections": {}44}Example response#
This is a sample from a recorded response, lists and long text are shortened, other people's names and handles are replaced. Status 200.
1{2 "ok": true,3 "credits_charged": 1,4 "credits_remaining": 4999,5 "cached": false,6 "cached_at": null,7 "request_id": "req_099c8397deae972028e6be4d",8 "data": {9 "object": "list",10 "items": [11 {12 "object": "comment",13 "platform": "youtube",14 "id": "UgwPwTibxdgqCHZxktd4AaABAg.8z9UZMV20LP8zH9Ebkoohj",15 "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&lc=UgwPwTibxdgqCHZxktd4AaABAg.8z9UZMV20LP8zH9Ebkoohj",16 "post_id": "dQw4w9WgXcQ",17 "parent_id": "UgwPwTibxdgqCHZxktd4AaABAg",18 "author": {19 "id": "1000000001",20 "handle": "sample_user",21 "name": "Sample User",22 "url": null,23 "avatar_url": null,24 "verified": false25 },26 "text": "Nice troll 👌",27 "published_at": "2019-10-30T00:00:00Z",28 "stats": {29 "likes": 3200,30 "replies": 0,31 "dislikes": null32 },33 "is_pinned": null,34 "is_by_creator": false,35 "extra": {36 "is_artist": false,37 "is_edited": false,38 "likes_approximate": true,39 "likes_text": "3.2K",40 "published_at_approximate": true,41 "published_text": "7 years ago"42 }43 },44 {45 "object": "comment",46 "platform": "youtube",47 "id": "UgwPwTibxdgqCHZxktd4AaABAg.8z9UZMV20LP8zHFw5wSZAR",48 "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&lc=UgwPwTibxdgqCHZxktd4AaABAg.8z9UZMV20LP8zHFw5wSZAR",49 "post_id": "dQw4w9WgXcQ",50 "parent_id": "UgwPwTibxdgqCHZxktd4AaABAg",51 "author": {52 "id": "1000000001",53 "handle": "sample_user",54 "name": "Sample User",55 "url": null,56 "avatar_url": null,57 "verified": false58 },59 "text": "Nice 👌",60 "published_at": "2019-10-30T00:00:00Z",61 "stats": {62 "likes": 2500,63 "replies": 0,64 "dislikes": null65 },66 "is_pinned": null,67 "is_by_creator": false,68 "extra": {69 "is_artist": false,70 "is_edited": false,71 "likes_approximate": true,72 "likes_text": "2.5K",73 "published_at_approximate": true,74 "published_text": "7 years ago"75 }76 }77 ],78 "cursor": "Eg0SC2RRdzR3OVdnWGNRGAYy2gEKU2dldF9jb21tZW50X3dpdGhfcmVwbGllc19zdHJlYW0tLUNnZ0lnQVFWRjdmUk9CSUZDS0FnR0FFaURnb01DTl90cU9zRkVOQ2l5TXdEVUFCWUFRGlASGlVnd1B3VGlieGRncUNIWnhrdGQ0QWFBQkFnIgIIACoYVUN1QVhGa2dzdzFMN3hhQ2ZuZDVKSk93MgtkUXc0dzlXZ1hjUUAB...",79 "has_more": true,80 "parent": null81 },82 "cursor": "Eg0SC2RRdzR3OVdnWGNRGAYy2gEKU2dldF9jb21tZW50X3dpdGhfcmVwbGllc19zdHJlYW0tLUNnZ0lnQVFWRjdmUk9CSUZDS0FnR0FFaURnb01DTl90cU9zRkVOQ2l5TXdEVUFCWUFRGlASGlVnd1B3VGlieGRncUNIWnhrdGQ0QWFBQkFnIgIIACoYVUN1QVhGa2dzdzFMN3hhQ2ZuZDVKSk93MgtkUXc0dzlXZ1hjUUAB...",83 "has_more": true84}Response#
A list of Comment objects in data.items, with data.cursor and data.has_more.
See Data models for every field. The envelope around data is described in Responses.
Errors#
Failures are free: credits_charged is 0. Branch on error.code, never on the message.
| Code | HTTP | Retry | Meaning |
|---|---|---|---|
invalid_params | 400 | no | A parameter is missing, unknown or has the wrong type. |
unsupported_url | 400 | no | The URL is not one this endpoint accepts (wrong platform or form). |
not_found | 404 | no | The platform says this profile, post or item does not exist. |
Every request can also fail with the account and platform errors listed on the Errors page.
Related endpoints#
- YouTube channel details (
GET /v1/youtube/channel) - YouTube channel videos (
GET /v1/youtube/channel/videos) - Search inside a YouTube channel (
GET /v1/youtube/channel/search) - YouTube channel playlists (
GET /v1/youtube/channel/playlists) - YouTube channel Shorts (
GET /v1/youtube/channel/shorts) - YouTube channel live streams (
GET /v1/youtube/channel/lives) - YouTube channel community posts (
GET /v1/youtube/channel/community-posts) - YouTube video or Short details (
GET /v1/youtube/video)