Skip to content

Fetching comments

Collect video comments

When a scraping job is executed with the get_comments parameter set to true, all publicly available (non-deleted) comments for the specified video will be collected. You can retrieve these comments, along with any replies, using the following endpoint.
- No callback URL is required for this endpoint.
- No credits are used when calling this endpoint.

To retrieve comments, you’ll need to use the video_id associated with the target YouTube video. This value is provided in the scraping results.

Base URL

GET https://youtube-scraper-api.datashake.com/v1/scrape/:request_id/comments

Path parameters

request_id

Field type: string
Required: true
Description: The unique identifier for the scraping request.

Request parameters

video_id

Field type: string
Required: true
Description: The unique identifier for the YouTube video.

page

Field type: integer
Required: false
Description: The page number of the results to retrieve.

per_page

Field type: integer
Required: false
Description: The number of results to retrieve per page.

Code example
curl --location 'https://youtube-scraper-api.datashake.com/v1/scrape/1743405732704235622-3e02dd3d-6b32-49/comments?video_id=1iqra1ojEvM&page=1&per_page=10' --header 'x-api-key: your-api-key'
import requests

url = "https://youtube-scraper-api.datashake.com/v1/scrape/1743405732704235622-3e02dd3d-6b32-49/comments"

params = {
    "video_id": "1iqra1ojEvM",
    "page": 1,
    "per_page": 10
}
headers = {
    "x-api-key": "your-api-key"
}

response = requests.get(url=url, headers=headers, params=params)

Response

API response example
{
   "request_id":"1743405732704235622-3e02dd3d-6b32-49",
   "status":"completed",
   "credits_used":null,
   "request_metadata": {
        "url": "https://www.youtube.com/watch?v=1iqra1ojEvM"
        "callback_url": "http://example.com/callback",
        "external_identifier": "my-custom-id",
        "get_comments": true
    },
   "results":[
      {
         "video_id":"1iqra1ojEvM",
         "video_url":"https://www.youtube.com/watch?v=1iqra1ojEvM",
         "comment_id":"Ugyka1Y712dr3kIX4tN4AaABAg",
         "author":"@ihearuzi1493",
         "text":"how did they just make six stories look like an entire seamless movie, i’m so happy they’re back.",
         "replies_count":95,
         "vote_count":19000,
         "replies":[
            {
               "video_url":"https://www.youtube.com/watch?v=1iqra1ojEvM",
               "author":"@Bittler87",
               "text":"Editing. Next question.",
               "comment_id":"Ugyka1Y712dr3kIX4tN4AaABAg",
               "reply_id":"Ugyka1Y712dr3kIX4tN4AaABAg.AFbwlDTU74hAFbyo6jE-Ea",
               "vote_count":437
            },
            {
               "video_url":"https://www.youtube.com/watch?v=1iqra1ojEvM",
               "author":"@ihearuzi1493",
               "text":"@ found the party pooper over here everyone",
               "comment_id":"Ugyka1Y712dr3kIX4tN4AaABAg",
               "reply_id":"Ugyka1Y712dr3kIX4tN4AaABAg.AFbwlDTU74hAFbz5kA9CJL",
               "vote_count":722
            },
            ...
         ]
      },
      ...
   ],
   "summary":null,
   "pagination":{
      "total":20,
      "page":1,
      "per_page":10,
      "total_pages":2
   }
}