# YouTube Videos & Reels API

Scrape YouTube videos and Reels — by search query, channel URL, or direct video URLs. Get views, likes, comments, duration, publish date, description, keywords, category, channel info, and thumbnails.

**Pricing:** $0.5 / 1k videos

**Endpoint:** `POST /v1/data/youtube/videos/run`

**Auth:** `Authorization: Bearer mk_live_...`

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | No | Keyword or phrase to search YouTube (e.g. 'python tutorial'). Returns ranked video results matching the query. |
| `channelUrl` | string | No | YouTube channel URL (e.g. https://www.youtube.com/@MrBeast or https://www.youtube.com/channel/UC...) or @handle. Returns all videos from the channel. |
| `urls` | array | No | Direct YouTube video URLs (e.g. https://www.youtube.com/watch?v=...). One per line. Returns full metadata for each video. |
| `maxResults` | integer | No | Total number of videos to return. Applies to Search and Channel modes. |

## Example

```bash
curl -X POST https://api.mindcase.co/v1/data/youtube/videos/run \
  -H "Authorization: Bearer mk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"params":{}}'
```

```python
import requests

resp = requests.post(
    "https://api.mindcase.co/v1/data/youtube/videos/run",
    headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
    json={"params": {}},
)
data = resp.json()
```

## Get the results

`run` is async and returns a `job_id`. Poll until `status` is `completed`, then read the rows:

```bash
# 1) check status
curl https://api.mindcase.co/v1/jobs/JOB_ID \
  -H "Authorization: Bearer mk_live_YOUR_API_KEY"

# 2) when status == completed, fetch the rows
curl https://api.mindcase.co/v1/jobs/JOB_ID/results \
  -H "Authorization: Bearer mk_live_YOUR_API_KEY"
```

Full API reference (auth, jobs, balance, endpoints): https://mindcase.co/skills.md

## Response columns

| Field | Display name | Type |
|-------|--------------|------|
| `type` | Type | text |
| `title` | Title | text |
| `videoUrl` | Video URL | url |
| `views` | Views | number |
| `likes` | Likes | number |
| `comments` | Comments | number |
| `durationS` | Duration (s) | number |
| `published` | Published | text |
| `description` | Description | text |
| `keywords` | Keywords | array |
| `category` | Category | text |
| `isLive` | Is Live | boolean |
| `thumbnail` | Thumbnail | url |
| `channel` | Channel | text |
| `channelHandle` | Channel Handle | text |
| `subscribers` | Subscribers | text |
| `channelUrl` | Channel URL | url |
| `channelBadges` | Channel Badges | text |
