> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brightdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# YouTube Scraper API endpoints

> Send synchronous requests to all 3 Bright Data YouTube Scraper API endpoints with copy-paste examples for channels, videos and comments collection.

This guide shows you how to send a synchronous request to each Bright Data YouTube Scraper API endpoint. It covers channels, videos, and comments.

## Prerequisites

* A [Bright Data account](https://brightdata.com/products/web-scraper/youtube?hs_signup=1\&utm_source=docs) with an active API key
* Completed the [Quickstart](/products/scrapers/youtube/quickstart)

## Request structure

Every synchronous request follows the same pattern:

```http theme={null}
POST https://api.brightdata.com/datasets/v3/scrape?dataset_id={DATASET_ID}&format=json
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

[{"url": "https://www.youtube.com/..."}]
```

The only thing that changes between endpoints is the `dataset_id` and the input URL format.

<Note>
  The `/scrape` endpoint is built for real-time, single-URL requests. Bright Data recommends 20 URLs or fewer per request, a best practice rather than a hard limit, and the endpoint waits up to 1 minute. If collection takes longer, the response is HTTP `202` with a `snapshot_id` instead of data, and collection continues asynchronously. Fetch the result with [async requests](/products/scrapers/scrapers-library/async-requests) or have it pushed to you with [webhook delivery](/products/scrapers/scrapers-library/data-delivery).
</Note>

## How to scrape YouTube channels

**Dataset ID:** `gd_lk538t2k2p1k3oos71`

```bash theme={null}
curl -X POST \
  "https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_lk538t2k2p1k3oos71&format=json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{"url": "https://www.youtube.com/@MrBeast"}]'
```

You should see a `200` response. Processing time varies with target-site conditions and scraper workload.

<Accordion title="Example response">
  ```json theme={null}
  [
    {
      "subscribers": 516000000,
      "url": "https://www.youtube.com/@mrbeast",
      "handle": "@MrBeast",
      "handle_md5": "dd748d5dfc88b91ea388429c3c685874",
      "banner_img": "https://yt3.googleusercontent.com/mHMO_eEMp0dPvh0ADwXhPXNYb_GnjSVsLI8biqF1CpxT8OPl7izhNQsDPD3JHhd5y5Mg9GrP=w2560-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-...",
      "profile_image": "https://yt3.googleusercontent.com/nxYrc_1_2f77DoBadyxMTmv7ZpRZapHR5jbuYe7PlPd5cIRJxtNNEYyOC0ZsxaDyJJzXrnJiuDE=s160-c-k-c0x00ffffff-no-rj",
      "name": "MrBeast",
      "Description": "SUBSCRIBE FOR A COOKIE!\nNew MrBeast or MrBeast Gaming video every single Saturday at noon eastern time!\nAccomplishments:\n- Raised $20,000,000 To Plant 20,000...",
      "videos_count": 1000,
      "created_date": "2012-02-19T00:00:00.000Z"
    }
  ]
  ```
</Accordion>

[Full Channels response schema](/api-reference/scrapers/social-media-apis/youtube-channels-collect-by-url)

### Which output fields does the YouTube channels scraper return?

The YouTube channels scraper (`gd_lk538t2k2p1k3oos71`, `collect_by_url`) returns 21 output fields.

<Accordion title="Output fields (21)">
  | Field | Type | Description |
  | - | - | - |
  | `url` | url | URL that link directly to the YouTube profile |
  | `handle` | text | Unique to each user (e.g., @name) |
  | `handle_md5` | text | This field stores the MD5 hash of the handle field. |
  | `banner_img` | url | URL that links to the banner photo |
  | `profile_image` | url | URL that link to the profile picture |
  | `name` | text | Profile name |
  | `subscribers` | number | How many subscribers the profile have |
  | `Description` | text | Brief descriptions or statements that users write to introduce themselves or share their interests and passions on YouTube |
  | `videos_count` | number | How many videos the profile have |
  | `created_date` | date | The date the profile was created |
  | `views` | number | How many views the profile have |
  | `Details` | object | channel Details |
  | `Links` | array | External websites that users may link to from their YouTube profiles |
  | `identifier` | text | identifier |
  | `discovery_input` | object | Discovery input value |
  | `id` | text | channel id |
  | `has_podcast` | boolean | has podcast indicator |
  | `top_videos` | array | top videos |
  | `featured_video` | url | Featured Video |
  | `featured_channels` | array | featured channels |
  | `collaborations` | array | Collaborations videos |
</Accordion>

Machine-readable version with the input schema: [`/scrapers/gd_lk538t2k2p1k3oos71.json`](/scrapers/gd_lk538t2k2p1k3oos71.json)

## How to scrape YouTube videos

**Dataset ID:** `gd_lk56epmy2i5g7lzu0k`

```bash theme={null}
curl -X POST \
  "https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_lk56epmy2i5g7lzu0k&format=json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}]'
```

<Accordion title="Example response">
  ```json theme={null}
  [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
      "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
      "views": 1812511291,
      "likes": 19374379,
      "date_posted": "2009-10-25T06:57:33.000Z",
      "description": "The official video for “Never Gonna Give You Up” by Rick Astley. \n\nNever: The Autobiography 📚 OUT NOW! \nFollow this link to get your copy and listen to Rick...",
      "num_comments": 2457228,
      "youtuber": "@RickAstleyYT",
      "youtuber_md5": "4fc65cd6213b5c0f1d04c2aa3006f46a",
      "video_url": "https://rr2---sn-n4v7snse.googlevideo.com/videoplayback?expire=1788712345&ei=OUGdaoSULZ-RsfIP8OmfsAo&ip=208.41.164.3&id=o-ALklNMQDHiVh32KdRiuWf9qyPo-8mNxywN-..."
    }
  ]
  ```
</Accordion>

[Full Videos response schema](/api-reference/scrapers/social-media-apis/youtube-videos-collect-by-url)

### Which output fields does the YouTube videos scraper return?

The YouTube videos scraper (`gd_lk56epmy2i5g7lzu0k`, `collect_by_url`) returns 49 output fields.

<Accordion title="Output fields (49)">
  | Field | Type | Description |
  | - | - | - |
  | `url` | url | The full YouTube watch URL of the collected video |
  | `title` | text | Title of the YouTube video |
  | `youtuber` | text | The channel handle extracted from the channel's browse endpoint |
  | `youtuber_md5` | text | MD5 hash of the youtuber field |
  | `video_url` | url | Direct streaming URL of the video file, extracted from YouTube's adaptive formats or decoded from signatureCipher |
  | `video_length` | number | Duration of the video in seconds |
  | `likes` | number | Number of likes received by the video |
  | `views` | number | Number of views the video has received |
  | `date_posted` | date | Date when the video was published |
  | `description` | text | Text description accompanying the video |
  | `num_comments` | number | Number of comments on the video, as displayed by YouTube (includes both top-level comments and replies in YouTube's count) |
  | `subscribers` | number | Number of subscribers to the YouTube channel |
  | `music` | object | Information about the music used in the video. Only present when YouTube's Content ID system has identified music in the video |
  | `video_id` | text | Unique identifier for the YouTube video |
  | `channel_url` | url | URL-encoded URL of the YouTube channel, derived from the channel's canonical browse endpoint |
  | `preview_image` | image | URL of the preview image for the video |
  | `shortcode` | text | The unique short identifier of the video, identical to video\_id, used across all YouTube video types including regular videos and Shorts |
  | `verified` | boolean | Indicates whether the channel is verified |
  | `handle_name` | text | The display name of the YouTube channel as shown on the video page |
  | `avatar_img_channel` | url | The URL of the avatar image of the YouTube channel |
  | `is_sponsored` | boolean | Indicates whether the video contains a paid content overlay as declared by YouTube |
  | `related_videos` | array | List of URLs of videos shown in the sidebar alongside the current video |
  | `license` | url | URL of the video's license as declared in YouTube's video metadata |
  | `viewport_frames` | text | Resolution of the primary video stream format, derived from YouTube's streaming data |
  | `current_optimal_res` | text | Current and optimal video resolution with frame rate, from YouTube's streaming format metadata |
  | `codecs` | text | Video and audio codec strings formatted as video codec and audio codec, extracted from YouTube's adaptive streaming formats |
  | `color` | text | Color primaries of the video stream, extracted from YouTube's adaptive format color info |
  | `quality` | text | Quality identifier of the first adaptive streaming format as reported by YouTube |
  | `quality_label` | text | Human-readable video quality label as reported by YouTube |
  | `post_type` | text | Type of YouTube content inferred from the URL structure. Possible values: post for standard video, short for YouTube Short, or N/A |
  | `youtuber_id` | text | YouTube's internal channel ID, distinct from the channel handle |
  | `transcript` | text | Full plain-text transcript of the video, compiled from YouTube's caption tracks. English captions are preferred, falls back to the first available language if English is unavailable |
  | `formatted_transcript` | array | Timestamped transcript segments from YouTube's caption tracks, each containing start time, end time, and duration in milliseconds, and the caption text |
  | `hashtags` | array | List of hashtags found in the video title or description, each with the hashtag text and its YouTube search link |
  | `tags` | array | Tags of the video |
  | `next_recommended_videos` | array | Videos shown as end-screen cards during the final seconds of the video, including timing in milliseconds and display style |
  | `recommended_videos` | array | Videos recommended by YouTube in the sidebar alongside the current video |
  | `transcript_language` | array | List of caption and transcript languages available for this video on YouTube, including whether each track was auto-generated |
  | `chapters` | array | List of chapter markers defined by the creator, each with a title, start time in milliseconds, and preview image |
  | `transcription_language` | text | The language code requested by the caller for transcript retrieval, passed as an input parameter at collection time |
  | `is_age_restricted` | boolean | Whether the video is age-restricted, inferred from a non-OK playability status combined with an age-related reason from YouTube |
  | `channel_url_decoded` | text | Plain-text percent-decoded version of the channel URL |
  | `category` | text | YouTube's content category assigned to the video, from YouTube's predefined category taxonomy |
  | `audio_tracks` | array | audio Tracks |
  | `made_for_kids` | boolean | Indicates whether the video is designated as made for kids, inferred from the YouTube miniplayer playback mode |
  | `player_notification_text` | text | User-facing notification text shown inside the video player |
  | `ai_content_label` | boolean | Indicates whether the video has been labeled as AI-generated or significantly AI-altered, either by the creator or auto-detected by YouTube. |
  | `live_status` | text | Livestream status of the video, equivalent to yt-dlp's live\_status. One of "is\_live", "was\_live", or "not\_live", parsed from YouTube's info string (e.g. "Streamed live 29 minutes ago") or defaulted to "not\_live" for regular videos |
  | `comments` | array | 10 Most relevant comments of the video |
</Accordion>

Machine-readable version with the input schema: [`/scrapers/gd_lk56epmy2i5g7lzu0k.json`](/scrapers/gd_lk56epmy2i5g7lzu0k.json)

## How to scrape YouTube comments

**Dataset ID:** `gd_lk9q0ew71spt1mxywf`

```bash theme={null}
curl -X POST \
  "https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_lk9q0ew71spt1mxywf&format=json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}]'
```

<Accordion title="Example response">
  ```json theme={null}
  [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
      "likes": 311000,
      "replies": 0,
      "comment_id": "Ugzge340dBgB75hWBm54AaABAg",
      "comment_text": "can confirm: he never gave us up",
      "username": "@Yo***e",
      "username_md5": "0e4d7a0778633b4acf6631dd251f0797",
      "user_channel": "https://www.youtube.com/@YouTube",
      "date": "1 year ago",
      "video_id": "dQw4w9WgXcQ"
    }
  ]
  ```
</Accordion>

[Full Comments response schema](/api-reference/scrapers/social-media-apis/youtube-comments-collect-by-url)

### Which output fields does the YouTube comments scraper return?

The YouTube comments scraper (`gd_lk9q0ew71spt1mxywf`, `collect_by_url`) returns 16 output fields.

| Field | Type | Description |
| - | - | - |
| `comment_id` | text | Unique identifier for each comment |
| `comment_text` | text | The text content of the comment |
| `likes` | number | Number of likes received by the comment |
| `replies` | number | Number of replies to the comment |
| `username` | text | Username of the commenter |
| `username_md5` | text | This field stores the MD5 hash of the username field. |
| `user_channel` | text | URL of the commenter's YouTube channel |
| `date` | text | Date when the comment was posted |
| `url` | url | Web address of the YouTube video where the comment was posted |
| `video_id` | text | Unique identifier for the YouTube video |
| `replies_value` | array | Array of reply objects associated with this comment |
| `replies_without_names` | array | Array of reply objects with personally identifiable information (usernames) removed, containing only MD5 hashed user identifiers |
| `user_id` | text | Unique identifier for the commenter's YouTube channel |
| `mentioned_timestamps_minutes` | array | Array of timestamps mentioned in the comment, formatted in minutes (e.g., '2:35') |
| `mentioned_timestamps_seconds` | array | Array of timestamps mentioned in the comment, converted to total seconds |
| `date_iso` | date | Date in ISO format |

Machine-readable version with the input schema: [`/scrapers/gd_lk9q0ew71spt1mxywf.json`](/scrapers/gd_lk9q0ew71spt1mxywf.json)

## Quick reference: dataset IDs

| Endpoint | Dataset ID | URL pattern |
| :- | :- | :- |
| Videos | `gd_lk56epmy2i5g7lzu0k` | `youtube.com/watch?v={video_id}` |
| Channels | `gd_lk538t2k2p1k3oos71` | `youtube.com/@{handle}` |
| Comments | `gd_lk9q0ew71spt1mxywf` | `youtube.com/watch?v={video_id}` |

## Output formats

Control the response format with the `format` query parameter:

| Value | Description |
| :- | :- |
| `json` | JSON array |
| `ndjson` | Newline-delimited JSON, one record per line (default) |
| `csv` | Comma-separated values |

These are the `format` values for `/scrape`. The full list, NDJSON (default), JSON, JSON lines, CSV and Parquet, and where each applies is in [output formats](/products/scrapers/scrapers-library/data-delivery#which-output-formats-can-i-use).

## Related

<CardGroup cols={2}>
  <Card title="Async batch requests" icon="layer-group" href="/products/scrapers/scrapers-library/async-requests">
    Scrape hundreds of URLs in a single batch job.
  </Card>

  <Card title="API reference" icon="code" href="/api-reference/scrapers/social-media-apis/youtube-channels-collect-by-url">
    Full parameter and response field reference.
  </Card>
</CardGroup>
