logo

YouTube Video API

View as Markdown

Fetch YouTube video details, channels, comments, chapters, related videos, and publication timestamps as structured JSON

The YouTube Video API returns structured details for one video, including its channel, description, chapters, related and end-screen videos, comments, and pagination tokens. It does not require JavaScript rendering or add a render fee.

Credit Usage: Each request costs 10 credits, including continuation requests. For bulk processing, use the Async API with plugins.

Key Features

  • Machine-readable publication time: published_at is an RFC 3339 timestamp in UTC, suitable for sorting and video-age calculations.
  • Stable channel identifiers: channel.channel_id and comments[].author.channel_id remain stable when a channel changes its display name or handle.
  • Exact numeric counts: extracted_views, extracted_likes, and extracted_subscribers complement YouTube's formatted display strings.
  • Complete video metadata: Retrieve the description and links, chapters, related videos, end-screen videos, and transcript availability.
  • Comments and replies: Use continuation tokens to load comments, sort by newest or top, and fetch replies.
  • Localization: Control display strings with hl and influence related-video ranking with gl.

Endpoint

GET https://api.scrape.do/plugin/google/youtube/video

Request Parameters

Required

ParameterTypeDescription
tokenstringYour Scrape.do API authentication token
vstringThe 11-character YouTube video ID from a watch?v=... URL. Required for initial and continuation requests

Localization

ParameterTypeDefaultDescription
hlstringenInterface language, such as en, de, fr, ja, tr, or pt-br. Controls localized dates and count suffixes
glstringusTwo-letter country code, such as us, gb, de, fr, or jp. Influences related-video ranking

Pagination

ParameterTypeDescription
next_page_tokenstringA continuation token from a previous response. Accepts related-video, comment, comment-sorting, and reply tokens

The endpoint detects the token type automatically and returns the corresponding collection.


Example Requests

Video Details

curl "https://api.scrape.do/plugin/google/youtube/video?v=dQw4w9WgXcQ&token=$TOKEN"

Localized Details

curl "https://api.scrape.do/plugin/google/youtube/video?v=dQw4w9WgXcQ&hl=fr&gl=fr&token=$TOKEN"

Pass related_videos_next_page_token from the previous response:

curl "https://api.scrape.do/plugin/google/youtube/video?v=dQw4w9WgXcQ&next_page_token=CBQSDRIL...&token=$TOKEN"

Comments or Replies

Pass comments_next_page_token, a token from comments_sorting_token, or a comment's replies_next_page_token:

curl "https://api.scrape.do/plugin/google/youtube/video?v=dQw4w9WgXcQ&next_page_token=Eg0SC2RR...&token=$TOKEN"

Response Modes

The endpoint uses one response schema with three modes. Fields that do not apply to the current mode are omitted.

ModeTriggerPopulated fields
Video detailsNo next_page_tokenVideo metadata, channel, description, chapters, related videos, end-screen videos, comment tokens, and transcript token
Related videosrelated_videos_next_page_tokenrelated_videos and a new related_videos_next_page_token
Comments or repliesComment, sorting, or reply tokencomments and, when available, comments_next_page_token

Video Details Response

{
  "search_parameters": {
    "engine": "google_youtube_video",
    "v": "dQw4w9WgXcQ",
    "gl": "us",
    "hl": "en"
  },
  "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "thumbnail": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/maxresdefault.webp",
  "channel": {
    "name": "Rick Astley",
    "channel_id": "UCuAXFkgsw1L7xaCfnd5JJOw",
    "link": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw",
    "thumbnail": "https://yt3.ggpht.com/...",
    "subscribers": "4.51M subscribers",
    "extracted_subscribers": 4510000,
    "verified": true
  },
  "views": "1,790,053,431 views",
  "extracted_views": 1790053431,
  "likes": "19M",
  "extracted_likes": 19222757,
  "published_date": "Oct 24, 2009",
  "published_at": "2009-10-25T06:57:33Z",
  "description": { "content": "The official video...", "links": [] },
  "chapters": [],
  "related_videos": [],
  "related_videos_next_page_token": "CBQSDRILZFF3NHc5V2dYY1E...",
  "end_screen_videos": [],
  "comments_next_page_token": "Eg0SC2RRdzR3OVdnWGNR...",
  "comments_sorting_token": [],
  "transcript": { "token": "CgtkUXc0dzlXZ1hjUQ..." }
}

Publication Fields

FieldTypeDescription
published_datestringYouTube's day-precision display date, localized by hl, such as Oct 24, 2009 or 3 Nis 2016
published_atstringRFC 3339 publication timestamp, always in UTC, such as 2009-10-25T06:57:33Z

Use published_at for chronological sorting, precise video age, and rate-per-hour calculations. Use published_date when you need the text shown for the requested locale. On rare videos where YouTube does not provide an exact timestamp, published_at is omitted while published_date can still be present.

channel

FieldTypeDescription
namestringChannel display name
channel_idstringStable UC... channel identifier
linkstringAbsolute channel URL. YouTube may return either an @handle or /channel/<id> URL
thumbnailstringChannel avatar URL
subscribersstringFormatted subscriber count, localized by hl
extracted_subscribersnumberParsed numeric subscriber count
verifiedbooleantrue for verified channels and official artist channels. Omitted when false

Use channel_id as the durable identifier instead of parsing link, because channel handles and display names can change.

Views and Likes

FieldTypeDescription
viewsstringFormatted view count as displayed by YouTube
extracted_viewsnumberExact numeric view count
likesstringCompact like count as displayed on the like button, such as 19M
extracted_likesnumberExact numeric like count

description

{
  "content": "The official video for Never Gonna Give You Up...",
  "links": [
    {
      "start_index": 180,
      "length": 16,
      "text": "#rickastleynever",
      "url": "https://www.youtube.com/hashtag/rickastleynever"
    }
  ]
}

links[].start_index and links[].length use UTF-16 code units, matching JavaScript string indexing. External targets use YouTube's redirect URL when that is what appears on the page.

chapters

Present only when the creator has defined chapters.

[
  {
    "title": "Introduction",
    "thumbnail": "https://i.ytimg.com/vi/...",
    "time_start": 0
  },
  {
    "title": "Variables",
    "thumbnail": "https://i.ytimg.com/vi/...",
    "time_start": 208
  }
]

time_start is the chapter's start offset in seconds.

The initial response usually includes about 20 sidebar suggestions. Use related_videos_next_page_token to retrieve more.

[
  {
    "video_id": "u_cLVh73u_o",
    "link": "https://www.youtube.com/watch?v=u_cLVh73u_o",
    "thumbnail": {
      "static": "https://i.ytimg.com/vi/u_cLVh73u_o/hqdefault.jpg",
      "rich": "https://i.ytimg.com/an_webp/u_cLVh73u_o/mqdefault_6s.webp"
    },
    "title": "80'S MUSIC ON THE ROAD",
    "published_date": "6 days ago",
    "views": "421K views",
    "extracted_views": 421000,
    "length": "2:16:49",
    "channel": {
      "name": "Every Song Is A Scar",
      "link": "https://www.youtube.com/@everysongisascar",
      "verified": true
    }
  }
]

thumbnail.rich is an animated preview and is omitted when unavailable. A live suggestion has live: true and a watcher count, so views, extracted_views, and published_date are omitted. Shorts shelves between suggestions are not included.

end_screen_videos

End-screen cards include fields such as video_id, link, title, thumbnail, views, extracted_views, and length. YouTube does not display a publication date or channel on these cards, so those fields are absent.

comments_sorting_token

[
  { "title": "Top", "token": "Eg0SC2RRdzR3OVdnWGNR..." },
  { "title": "Newest", "token": "Eg0SC2RRdzR3OVdnWGNR..." }
]

Pass either token as next_page_token to load comments in that order. The initial comments_next_page_token uses the default Top ordering.

transcript

{ "token": "CgtkUXc0dzlXZ1hjUQ..." }

This opaque token indicates that the video has a transcript. It is reserved for future use; this endpoint does not return transcript text.


Comments Response

Comment pages contain 20 items per batch. Reply pages contain 10 items per batch.

{
  "search_parameters": {
    "engine": "google_youtube_video",
    "v": "dQw4w9WgXcQ",
    "gl": "us",
    "hl": "en",
    "next_page_token": "Eg0SC2RR..."
  },
  "comments": [
    {
      "comment_id": "UgzB3ZO9YOWY0PJqmZR4AaABAg",
      "content": "can confirm: he never gave us up",
      "published_date": "1 year ago",
      "likes": "265K",
      "extracted_likes": 265000,
      "replies_count": 961,
      "pinned": true,
      "author": {
        "name": "@YouTube",
        "link": "https://www.youtube.com/@YouTube",
        "channel_id": "UCBR8-60-B28hp2BmDPdntcQ",
        "thumbnail": "https://yt3.ggpht.com/...",
        "verified": true
      },
      "replies_next_page_token": "Eg0SC2RRdzR3OVdnWGNR..."
    }
  ],
  "comments_next_page_token": "Eg0SC2RRdzR3OVdnWGNR..."
}
FieldTypeDescription
comment_idstringStable comment identifier
contentstringComment text
published_datestringRelative date localized by hl; may include an (edited) suffix
likesstringFormatted like count
extracted_likesnumberParsed numeric like count
replies_countnumberNumber of replies. Omitted when 0
pinnedbooleantrue for a creator-pinned comment. Omitted when false
author.channel_idstringStable identifier for the comment author's channel
author.is_creatorbooleantrue when the video's creator wrote the comment. Omitted when false
replies_next_page_tokenstringPass as next_page_token to fetch replies

Reply batches use the same comments item shape. They omit replies_next_page_token and use comments_next_page_token for additional replies in the same thread.


Pagination Guidelines

  • Treat every continuation token as opaque and pass it back unchanged.
  • Tokens belong to a specific video, collection, and position. Do not reuse them across videos.
  • Stop when the response no longer includes the relevant next-page token.
  • Keep v on every continuation request. The continuation token selects the underlying video content.
  • Tokens containing percent sequences can be passed as returned or URL-encoded with curl -G --data-urlencode.

Error Handling

StatusErrorCause
400token is requiredMissing API token
400v is requiredMissing video ID
400v must be an 11-character YouTube video idMalformed video ID
400gl must be a 2-letter country codeInvalid country code
400hl must be a valid language code (e.g., en, de, pt-br)Invalid language code
401Gateway authorization errorInvalid or inactive API token
429Gateway rate-limit errorConcurrent-request or monthly quota limit reached
502upstream returned truncated pageYouTube returned a partial page. Retry the request
502failed to parse video resultsInvalid or expired continuation token, unavailable video, or unexpected upstream response
502unexpected responseYouTube returned a non-200 status. Retry the request
502request failedNetwork-level failure. Retry the request
500decompression failedResponse decompression failed
500internal server errorUnhandled server error. Report it if persistent

Notes

  • Private, removed, age-gated, or region-blocked videos can return 502 failed to parse video results and are not charged.
  • Optional fields are omitted when YouTube does not provide them; one unavailable field does not fail an otherwise valid response.
  • Display strings follow hl, while extracted_* fields are normalized to integers when the value can be determined safely.
  • Match hl and gl, such as hl=fr&gl=fr, for consistent localized metadata and regional ranking.

On this page