Docs menu

YouTube comment replies

Beta 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
  • Status: Beta. Built and tested against recorded responses; the shape may still gain fields.
  • Cache: Results are kept up to 30 days; send max_age_days to reuse them for free.
  • Timeout: A request still running after about 25 seconds answers 202 with a job to poll (Batch and jobs).

Parameters#

NameTypeRequiredDescription
urlURLnoVideo or Short URL (watch, youtu.be, shorts, live, embed). Accepted hosts: youtube.com, youtu.be.
idstringno11-character video id. Also accepted as videoId, video_id.
comment_idstringnoId of the parent comment. Also accepted as commentId.

Every request also accepts:

  • cursor: the cursor from the previous page (Pagination).
  • trim: true for a smaller response without null fields and extra.
  • raw: true to also get the platform's original object as raw.
  • 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).

curl
curl -G "https://api.socialscrape.io/v1/youtube/video/comment/replies" \
  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \
  --data-urlencode "id=dQw4w9WgXcQ" \
  --data-urlencode "comment_id=UgwPwTibxdgqCHZxktd4AaABAg" \
  --data-urlencode "cursor=Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd3UHdUaWJ4ZGdxQ0haeGt0ZDRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3dQd1RpYnhkZ3FDSFp4a3RkNEFhQUJBZw%3D%3D"
Python
import os
import requests

params = {
    "id": "dQw4w9WgXcQ",
    "comment_id": "UgwPwTibxdgqCHZxktd4AaABAg",
    "cursor": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd3UHdUaWJ4ZGdxQ0haeGt0ZDRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3dQd1RpYnhkZ3FDSFp4a3RkNEFhQUJBZw%3D%3D",
}
res = requests.get(
    "https://api.socialscrape.io/v1/youtube/video/comment/replies",
    headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
    params=params,
)
body = res.json()

if body["ok"]:
    print(body["data"])
else:
    print(body["error"]["code"], body["error"]["message"])
TypeScript
const url = new URL("https://api.socialscrape.io/v1/youtube/video/comment/replies");
url.search = new URLSearchParams({
  "id": "dQw4w9WgXcQ",
  "comment_id": "UgwPwTibxdgqCHZxktd4AaABAg",
  "cursor": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd3UHdUaWJ4ZGdxQ0haeGt0ZDRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3dQd1RpYnhkZ3FDSFp4a3RkNEFhQUJBZw%3D%3D"
}).toString();
const res = await fetch(url, {
  headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();

if (body.ok) {
  console.log(body.data);
} else {
  console.error(body.error.code, body.error.message);
}
n8n
{
  "nodes": [
    {
      "name": "SocialScrape YouTube comment replies",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "method": "GET",
        "url": "https://api.socialscrape.io/v1/youtube/video/comment/replies",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "id",
              "value": "dQw4w9WgXcQ"
            },
            {
              "name": "comment_id",
              "value": "UgwPwTibxdgqCHZxktd4AaABAg"
            },
            {
              "name": "cursor",
              "value": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd3UHdUaWJ4ZGdxQ0haeGt0ZDRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3dQd1RpYnhkZ3FDSFp4a3RkNEFhQUJBZw%3D%3D"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
            }
          ]
        }
      }
    }
  ],
  "connections": {}
}

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.

{
  "ok": true,
  "credits_charged": 1,
  "credits_remaining": 4999,
  "cached": false,
  "cached_at": null,
  "request_id": "req_099c8397deae972028e6be4d",
  "data": {
    "object": "list",
    "items": [
      {
        "object": "comment",
        "platform": "youtube",
        "id": "UgwPwTibxdgqCHZxktd4AaABAg.8z9UZMV20LP8zH9Ebkoohj",
        "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&lc=UgwPwTibxdgqCHZxktd4AaABAg.8z9UZMV20LP8zH9Ebkoohj",
        "post_id": "dQw4w9WgXcQ",
        "parent_id": "UgwPwTibxdgqCHZxktd4AaABAg",
        "author": {
          "id": "1000000001",
          "handle": "sample_user",
          "name": "Sample User",
          "url": null,
          "avatar_url": null,
          "verified": false
        },
        "text": "Nice troll 👌",
        "published_at": "2019-10-30T00:00:00Z",
        "stats": {
          "likes": 3200,
          "replies": 0,
          "dislikes": null
        },
        "is_pinned": null,
        "is_by_creator": false,
        "extra": {
          "is_artist": false,
          "is_edited": false,
          "likes_approximate": true,
          "likes_text": "3.2K",
          "published_at_approximate": true,
          "published_text": "7 years ago"
        }
      },
      {
        "object": "comment",
        "platform": "youtube",
        "id": "UgwPwTibxdgqCHZxktd4AaABAg.8z9UZMV20LP8zHFw5wSZAR",
        "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&lc=UgwPwTibxdgqCHZxktd4AaABAg.8z9UZMV20LP8zHFw5wSZAR",
        "post_id": "dQw4w9WgXcQ",
        "parent_id": "UgwPwTibxdgqCHZxktd4AaABAg",
        "author": {
          "id": "1000000001",
          "handle": "sample_user",
          "name": "Sample User",
          "url": null,
          "avatar_url": null,
          "verified": false
        },
        "text": "Nice 👌",
        "published_at": "2019-10-30T00:00:00Z",
        "stats": {
          "likes": 2500,
          "replies": 0,
          "dislikes": null
        },
        "is_pinned": null,
        "is_by_creator": false,
        "extra": {
          "is_artist": false,
          "is_edited": false,
          "likes_approximate": true,
          "likes_text": "2.5K",
          "published_at_approximate": true,
          "published_text": "7 years ago"
        }
      }
    ],
    "cursor": "Eg0SC2RRdzR3OVdnWGNRGAYy2gEKU2dldF9jb21tZW50X3dpdGhfcmVwbGllc19zdHJlYW0tLUNnZ0lnQVFWRjdmUk9CSUZDS0FnR0FFaURnb01DTl90cU9zRkVOQ2l5TXdEVUFCWUFRGlASGlVnd1B3VGlieGRncUNIWnhrdGQ0QWFBQkFnIgIIACoYVUN1QVhGa2dzdzFMN3hhQ2ZuZDVKSk93MgtkUXc0dzlXZ1hjUUAB...",
    "has_more": true,
    "parent": null
  },
  "cursor": "Eg0SC2RRdzR3OVdnWGNRGAYy2gEKU2dldF9jb21tZW50X3dpdGhfcmVwbGllc19zdHJlYW0tLUNnZ0lnQVFWRjdmUk9CSUZDS0FnR0FFaURnb01DTl90cU9zRkVOQ2l5TXdEVUFCWUFRGlASGlVnd1B3VGlieGRncUNIWnhrdGQ0QWFBQkFnIgIIACoYVUN1QVhGa2dzdzFMN3hhQ2ZuZDVKSk93MgtkUXc0dzlXZ1hjUUAB...",
  "has_more": true
}

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.

CodeHTTPRetryMeaning
invalid_params400noA parameter is missing, unknown or has the wrong type.
unsupported_url400noThe URL is not one this endpoint accepts (wrong platform or form).
not_found404noThe 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.