# Brightdata Youtube

> Scrape YouTube via BrightData Datasets API. Collect videos by URL, channel info, comments, search results, Shorts, and transcripts/subtitles. Returns video metadata, engagement metrics, channel data, threaded comments, and timestamped transcripts. Use to monitor channels, analyze comments, search YouTube, or extract transcripts. Single and bulk with auto-batching.

- Skill: `buzzmatic/brightdata-youtube` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add buzzmatic/brightdata-youtube`
- Raw SKILL.md: https://api.skillmd.com/api/skills/buzzmatic/brightdata-youtube/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: Buzzmatic (https://skillmd.com/u/buzzmatic)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/buzzmatic/brightdata-youtube

---


# BrightData YouTube Scraper

YouTube data collection using BrightData's Datasets API. All operations save results to disk and return summaries to context.

## Quick Start

**Single Video:**
```bash
python skills/brightdata-youtube/scripts/fetch.py \
  --endpoint videos \
  --input "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
```

**Channel Info:**
```bash
python skills/brightdata-youtube/scripts/fetch.py \
  --endpoint channels \
  --input "https://www.youtube.com/@brightdata"
```

**Channel by Name (no URL needed):**
```bash
python skills/brightdata-youtube/scripts/fetch.py \
  --endpoint channels \
  --channel-name "brightdata"
```

**Search YouTube:**
```bash
python skills/brightdata-youtube/scripts/fetch.py \
  --endpoint search \
  --keyword "SEO tutorial" \
  --pages-to-search 3 \
  --type video
```

**Comments from Video:**
```bash
python skills/brightdata-youtube/scripts/fetch.py \
  --endpoint comments \
  --input "https://www.youtube.com/watch?v=dQw4w9WgXcQ" \
  --num-of-comments 50
```

**YouTube Short:**
```bash
python skills/brightdata-youtube/scripts/fetch.py \
  --endpoint shorts \
  --input "https://www.youtube.com/shorts/SXHMnicI6Pg"
```

**Video Transcript:**
```bash
python skills/brightdata-youtube/scripts/fetch.py \
  --endpoint transcripts \
  --input "https://www.youtube.com/watch?v=dQw4w9WgXcQ" \
  --language en
```

## Available Endpoints

| Endpoint | Dataset ID | Input Type | Description |
|----------|-----------|------------|-------------|
| `videos` | `gd_lk5ns7kz21pck8jpis` | Video URLs | Collect video data by URL |
| `channels` | `gd_ytc26hd9r2fhaq2i0g` | Channel URLs or name | Collect channel data |
| `comments` | `gd_lk5ns7kz21pck8jpis` | Video URLs | Collect comments from a video |
| `search` | `gd_lwdb9kf1cj0lf1doa0` | Keyword or search URL | Search YouTube |
| `shorts` | `gd_lz29oxyn3ry9mfpbs` | Shorts URLs | Collect YouTube Shorts data |
| `transcripts` | `gd_lz2915ty3pd2o05i2m` | Video URLs | Collect video transcripts/subtitles |

## Parameters

### Common Parameters

| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `--endpoint` | Yes | - | Endpoint type (see table above) |
| `--input` | Conditional | - | URL or path to batch file |
| `--batch` | No | false | Enable batch mode for file inputs |
| `--mode` | No | sync | API mode: `sync` or `async` |

### Channel Parameters (channels)

| Parameter | Required | Description |
|-----------|----------|-------------|
| `--channel-name` | No | Channel handle/name without @ (alternative to --input URL) |

### Search Parameters (search)

| Parameter | Required | Description |
|-----------|----------|-------------|
| `--keyword` | Yes* | Search query (*or use --input with search URL) |
| `--pages-to-search` | No | Number of result pages to collect (default: 1) |
| `--type` | No | Filter: `video`, `channel`, `playlist` |

### Comments Parameters (comments)

| Parameter | Required | Description |
|-----------|----------|-------------|
| `--num-of-comments` | No | Max comments to return (default: 100) |
| `--days-posted` | No | Only comments from last N days |

### Transcript Parameters (transcripts)

| Parameter | Required | Description |
|-----------|----------|-------------|
| `--language` | No | Preferred transcript language code (e.g., `en`) |

### Timing Parameters

| Parameter | Default | Description |
|-----------|---------|-------------|
| `--timeout` | 120 | Request timeout in seconds |
| `--max-wait` | 300 | Max polling wait time in seconds |
| `--poll-interval` | 5 | Polling interval in seconds |

## Batch Operations

### JSON Format (URLs)
```json
{
  "urls": [
    "https://www.youtube.com/watch?v=video1",
    "https://www.youtube.com/watch?v=video2"
  ]
}
```

### Search Batch
```json
{
  "searches": [
    {"keyword": "SEO tools", "pages_to_search": 3},
    {"keyword": "link building", "type": "video"},
    {"keyword": "technical SEO"}
  ]
}
```

### TXT Format
```
https://www.youtube.com/watch?v=video1
https://www.youtube.com/watch?v=video2
```

## Async Mode

For large batches, use async mode:

```bash
# Submit async request
python skills/brightdata-youtube/scripts/fetch.py \
  --endpoint videos \
  --input video_urls.json \
  --batch \
  --mode async

# Check status and retrieve results
python skills/brightdata-youtube/scripts/status.py \
  --snapshot-id <snapshot_id>
```

## Output Format

```json
{
  "success": true,
  "endpoint": "search",
  "mode": "sync",
  "record_count": 25,
  "output_file": "output/brightdata_youtube_search_20250327T123456.json",
  "summary": "Successfully scraped 25/25 YouTube search",
  "stats": {
    "total_inputs": 1,
    "successful": 25,
    "failed": 0
  }
}
```

## Video Output Fields

- `id` / `url` - Video identifier and URL
- `title` / `description` - Video title and description
- `channel` / `channel_url` / `channel_id` - Channel info
- `channel_subscribers` - Subscriber count
- `views` / `likes` / `comments_count` - Engagement metrics
- `published_date` / `duration` - Timing info
- `thumbnail` - Thumbnail URL
- `tags` / `category` - Classification
- `is_live` / `is_short` - Video type flags
- `language` / `subtitles_available` - Language info

## Channel Output Fields

- `id` / `url` / `title` - Channel identifiers
- `description` - Channel description
- `subscriber_count` / `video_count` / `view_count` - Metrics
- `joined_date` / `country` - Profile info
- `avatar` / `banner` - Images
- `is_verified` - Verification status
- `links` - External links
- `videos` - List of channel videos (array)

## Comment Output Fields

- `video_id` / `video_title` - Parent video info
- `comments[].comment_id` / `comments[].author` - Comment identifiers
- `comments[].text` / `comments[].published_date` - Content
- `comments[].likes` / `comments[].reply_count` - Engagement
- `comments[].replies` - Nested reply threads
- `total_comments` - Total count

## Transcript Output Fields

- `video_id` / `video_title` - Video info
- `language` / `is_auto_generated` - Transcript metadata
- `transcript[].text` / `transcript[].start` / `transcript[].duration` - Timestamped segments
- `full_text` - Complete transcript as single string
- `available_languages` - Available language codes

## API Configuration

Requires `BRIGHTDATA_API_TOKEN` in `.env`:

```env
BRIGHTDATA_API_TOKEN=your_api_token_here
```

## Limitations

- Rate limits depend on BrightData plan
- Platform ToS: ensure compliance with YouTube's Terms of Service
- URL formats: requires valid YouTube URLs
- Video and Comments share the same dataset_id; differentiated by input parameters

