# Youtube Video Downloader (`nextapi/youtube-video-downloader`)

Download YouTube video in 4K, HD, or metadata-only. Extract video metadata, comments, subtitles, thumbnail. Support for YouTube, YouTube Shorts, YouTube Music.

- **URL**: https://beta-securitybyobscurity.apify.com/nextapi/youtube-video-downloader.md
- **Developed by:** [NextAPI](https://beta-securitybyobscurity.apify.com/nextapi) (community)
- **Categories:** Videos, Automation, Other
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

# README

> **Professional YouTube video downloader and metadata extractor for Apify platform. Download videos in multiple qualities, extract comprehensive metadata, comments, and thumbnails with enterprise-grade reliability.**

### 🏆 Key Features

#### 📥 **Multi-Quality Downloads**

- **🎬 High Quality (4K/2160p)** - Ultra HD video downloads
- **📺 Medium Quality (720p/HD)** - High definition videos
- **📱 Low Quality (480p)** - Standard definition for faster processing
- **📋 Metadata Only** - Extract video information without downloading

#### 🔍 **Comprehensive Data Extraction**

- **📊 Video Metadata** - Title, description, duration, publish date
- **👤 Author Information** - Creator details, channel URLs, subscriber counts
- **📈 Engagement Metrics** - Views, likes, comments, shares
- **🎵 Audio Details** - Track titles, artists, audio quality
- **📝 Comments** - Full comment threads with author and engagement data
- **🖼️ Thumbnail** - High-quality video thumbnail

### 💻 Input Parameters

| Parameter       | Type   | Required | Description                 | Example                                       |
| --------------- | ------ | -------- | --------------------------- | --------------------------------------------- |
| `video_url`     | string | ✅       | YouTube video URL           | `https://www.youtube.com/watch?v=2TK9tFZoBRg` |
| `video_quality` | string | ❌       | Download quality preference | `"high"`, `"medium"`, `"low"`, `"metadata"`   |

#### 🎛️ Quality Options

| Quality    | Resolution | Description         | Use Case                            |
| ---------- | ---------- | ------------------- | ----------------------------------- |
| `high`     | 2160p/4K   | Ultra HD quality    | Professional content, archival      |
| `medium`   | 720p/HD    | High definition     | Standard viewing, social media      |
| `low`      | 480p       | Standard definition | Quick previews, mobile optimization |
| `metadata` | N/A        | Information only    | Data analysis, content research     |

**Default Value**: `video_quality` defaults to `"metadata"` if not specified

### 📤 Output Structure

```json
{
  "source_url": "https://www.youtube.com/watch?v=2TK9tFZoBRg",
  "processor": "https://apify.com/nextapi/youtube-video-downloader",
  "processed_at": "2024-01-15T10:30:00Z",
  "content_id": "2TK9tFZoBRg",
  "platform": "Youtube",
  "title": "Video Title",
  "description": "Video description...",
  "duration": 180,
  "published_at": "2024-01-01T00:00:00Z",
  "author": "Channel Name",
  "author_id": "UC123456789",
  "author_url": "https://youtube.com/channel/UC123456789",
  "categories": ["Entertainment", "Technology"],
  "tags": ["tutorial", "programming", "python"],
  "view_count": 1000000,
  "like_count": 50000,
  "dislike_count": 100,
  "shares_count": 5000,
  "comment_count": 2500,
  "width": 1920,
  "height": 1080,
  "fps": 30,
  "audio_title": "Background Music",
  "audio_artist": "Music Artist",
  "comments": [
    {
      "author": "Username",
      "text": "Great video!",
      "like_count": 10,
      "published_at": "2024-01-02T12:00:00Z"
    }
  ],
  "video_url": "https://apify.com/kv-store/downloaded-video.mp4",
  "image_url": "https://apify.com/kv-store/thumbnail.png",
  "total_size": 153600
}
```

#### 📊 Output Fields Description

| Field                   | Type   | Description                   |
| ----------------------- | ------ | ----------------------------- |
| `source_url`            | string | Original video URL            |
| `processor`             | string | Actor processor URL           |
| `processed_at`          | string | ISO timestamp                 |
| `content_id`            | string | Video ID                      |
| `platform`              | string | Source platform               |
| `title`                 | string | Video title                   |
| `description`           | string | Video description             |
| `duration`              | number | Duration in seconds           |
| `published_at`          | string | Publication date              |
| `author`                | string | Channel name                  |
| `author_id`             | string | Channel ID                    |
| `author_url`            | string | Channel URL                   |
| `categories`            | array  | Video categories              |
| `tags`                  | array  | Video tags                    |
| `view_count`            | number | View count                    |
| `like_count`            | number | Like count                    |
| `dislike_count`         | number | Dislike count                 |
| `shares_count`          | number | Share count                   |
| `comment_count`         | number | Comment count                 |
| `width`                 | number | Video width (px)              |
| `height`                | number | Video height (px)             |
| `fps`                   | number | Frames per second             |
| `audio_title`           | string | Audio track title             |
| `audio_artist`          | string | Audio artist                  |
| `video_url`             | string | Downloaded video URL          |
| `image_url`             | string | Thumbnail URL                 |
| `total_size`            | number | Total size in KB              |
| `comments`              | array  | Comment objects               |
| `comments.author`       | string | Comment author name           |
| `comments.text`         | string | Comment text content          |
| `comments.like_count`   | number | Number of likes on comment    |
| `comments.published_at` | string | Comment publication timestamp |

### 🎯 Use Cases

#### 📊 **Content Research & Analysis**

- Extract video metadata for market research
- Analyze engagement metrics and trends
- Monitor competitor content strategies

#### 🤖 **Automation & Integration**

- Batch process video collections
- Integrate with content management systems
- Automate social media content creation

#### 📚 **Educational & Training**

- Download educational content
- Extract transcripts for study materials
- Create offline learning resources

### 💰 Pricing

| Resource          | Cost         | Description                           |
| ----------------- | ------------ | ------------------------------------- |
| **Actor Usage**   | $0.0001      | Base execution cost                   |
| **Kilobyte (KB)** | $0.000036/KB | Video file processing (1MB = $0.0369) |

### 🔧 Technical Details

#### **Supported Platforms**

- ✅ YouTube (Primary)
- ✅ YouTube Shorts
- ✅ YouTube Music
- ✅ YouTube Live (recorded)

### ❓ FAQ

#### **Q: What video qualities are supported?**

A: We support 4K (2160p), HD (720p), SD (480p), and metadata-only extraction.

#### **Q: Can I download private or age-restricted videos?**

A: No, only publicly available videos can be downloaded. Private, unlisted, or age-restricted content requires authentication.

#### **Q: How long does processing take?**

A: Metadata extraction: ~5-10 seconds. Video downloads: 1-5 minutes depending on quality and file size.

#### **Q: Can I extract comments from any video?**

A: Yes, we extract all available comments including replies and engagement metrics.

### 🛠️ Troubleshooting

- **Download failed**: Video unavailable, network issues
- **Budget exceeded**: Task execution exceeds your Apify budget limit
- **Processing timeout**: Large files may take longer to process

### 🤝 Support & Community

- **📧 Support**: [Contact us](https://t.me/AiAgentApi)
- **💬 Community**: [Telegram Group](https://t.me/Apify_Actor)

# Actor input Schema

## `video_url` (type: `string`):

Enter the YouTube video URL

## `video_quality` (type: `string`):

Choose the video quality for download: High (4K), Medium (720p), Low (480p), or Metadata only

## Actor input object example

```json
{
  "video_url": "https://www.youtube.com/watch?v=2TK9tFZoBRg",
  "video_quality": "metadata"
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "video_url": "https://www.youtube.com/watch?v=2TK9tFZoBRg",
    "video_quality": "metadata"
};

// Run the Actor and wait for it to finish
const run = await client.actor("nextapi/youtube-video-downloader").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "video_url": "https://www.youtube.com/watch?v=2TK9tFZoBRg",
    "video_quality": "metadata",
}

# Run the Actor and wait for it to finish
run = client.actor("nextapi/youtube-video-downloader").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "video_url": "https://www.youtube.com/watch?v=2TK9tFZoBRg",
  "video_quality": "metadata"
}' |
apify call nextapi/youtube-video-downloader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=nextapi/youtube-video-downloader",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Youtube Video Downloader",
        "description": "Download YouTube video in 4K, HD, or metadata-only. Extract video metadata, comments, subtitles, thumbnail. Support for YouTube, YouTube Shorts, YouTube Music.",
        "version": "0.0",
        "x-build-id": "7lf5ayANxMVJ7zq4V"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/nextapi~youtube-video-downloader/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-nextapi-youtube-video-downloader",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/nextapi~youtube-video-downloader/runs": {
            "post": {
                "operationId": "runs-sync-nextapi-youtube-video-downloader",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/nextapi~youtube-video-downloader/run-sync": {
            "post": {
                "operationId": "run-sync-nextapi-youtube-video-downloader",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "video_url"
                ],
                "properties": {
                    "video_url": {
                        "title": "Video URL",
                        "type": "string",
                        "description": "Enter the YouTube video URL"
                    },
                    "video_quality": {
                        "title": "Video Quality",
                        "enum": [
                            "high",
                            "medium",
                            "low",
                            "metadata"
                        ],
                        "type": "string",
                        "description": "Choose the video quality for download: High (4K), Medium (720p), Low (480p), or Metadata only"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
