# YouTube Video Downloader (`coder_zoro/youtube-video-downloader`) Actor

Download YouTube videos in 240p–1080p with optional audio using Apify. Perfect for automation, content archiving, and video workflows

- **URL**: https://apify.com/coder_zoro/youtube-video-downloader.md
- **Developed by:** [Zoro](https://apify.com/coder_zoro) (community)
- **Categories:** Videos, Developer tools
- **Stats:** 153 total users, 0 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.90 / 1,000 results

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## 🧠 YouTube Downloader — Download YouTube Videos in Any Quality (With or Without Audio)

Easily download YouTube videos directly within Apify!\
This actor lets you fetch and save videos from YouTube in your preferred quality — from 240p up to 1080p — with optional audio merging using FFmpeg.\
Perfect for automation workflows, video data processing, or content archiving. Ideal for developers and content creators who need a reliable YouTube downloader API.

***

### 🚀 Features

✅ Download multiple YouTube videos at once\
✅ Choose your preferred video quality (240p, 360p, 480p, 720p, 1080p)\
✅ Include or exclude audio using FFmpeg merge\
✅ Get instant downloadable URLs in the output JSON\
✅ Integrates seamlessly with any Apify automation, scraping, or video workflow

This actor works as a YouTube video extractor, downloader, and automation tool, perfect for video archiving and content analysis.

***

### 📦 Input Schema

Your input JSON must follow this structure:

```json
{
  "includeAudio": true,
  "quality": "720",
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=5qGezR7nx3Q"
    },
    {
      "url": "https://www.youtube.com/watch?v=anotherVideo"
    }
  ]
}
```

#### 🧩 Parameters

| Field | Type | Description | Required | Example |
|-------|------|--------------|-----------|----------|
| `startUrls` | Array | List of YouTube video URLs to download. | ✅ | `[{ "url": "https://www.youtube.com/watch?v=5qGezR7nx3Q" }]` |
| `quality` | String | Desired video quality. Options: `240`, `360`, `480`, `720`, `1080`. | ❌ (default: `720`) | `"1080"` |
| `includeAudio` | Boolean | Whether to include audio in the final output. If true, merges audio and video using FFmpeg. | ❌ (default: `true`) | `true` |

***

### 📤 Output Example

The actor outputs a JSON array containing the original YouTube URL and the downloadable video URL hosted on Apify:

```json
[
  {
    "sourceUrl": "https://www.youtube.com/watch?v=5qGezR7nx3Q",
    "downloadUrl": "https://api.apify.com/v2/key-value-stores/meWWf8dAUJz4RFxQi/records/5qGezR7nx3Q.mp4?disableRedirect=false"
  }
]
```

Each record includes:

- `sourceUrl`: The original YouTube video link
- `downloadUrl`: The generated download link for the saved video file

***

### ⚙️ Example Use Cases

🎬 Video Archiving – Save YouTube videos for offline viewing or research.\
🤖 Automation Workflows – Integrate video downloading in Apify tasks or bots.\
📊 Content Analysis – Collect and process video data for machine learning or analytics.\
📱 Social Media Management – Automatically download videos to repurpose content.

This tool also works as a YouTube downloader API, YouTube video extractor, and video automation tool, making it perfect for developers, content creators, and marketers.

***

### 🧠 How It Works

1. Provide one or multiple YouTube URLs in the `startUrls` field.
2. Choose your preferred `quality` and toggle `includeAudio`.
3. Run the actor — it fetches the videos, processes them, and generates direct downloadable links.

This seamless workflow allows easy integration for video automation, YouTube scraping, and content archiving.

***

### 🧩 Technical Notes

- Uses FFmpeg for merging audio and video when `includeAudio` is true.
- Each downloaded file is temporarily stored in the Apify Key-Value Store, accessible via the `downloadUrl`.
- Supports batch downloading (multiple YouTube URLs).
- Compliant with Apify actor input schema for easy integration in platform UI or API calls.

# Actor input Schema

## `startUrls` (type: `array`):

List of YouTube video URLs to download.

## `quality` (type: `string`):

Desired video quality.

## `includeAudio` (type: `boolean`):

If true, downloads with audio using ffmpeg merge.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=5qGezR7nx3Q"
    }
  ],
  "quality": "720",
  "includeAudio": true
}
```

# 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 = {
    "startUrls": [
        {
            "url": "https://www.youtube.com/watch?v=5qGezR7nx3Q"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("coder_zoro/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 = { "startUrls": [{ "url": "https://www.youtube.com/watch?v=5qGezR7nx3Q" }] }

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

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

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

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=5qGezR7nx3Q"
    }
  ]
}' |
apify call coder_zoro/youtube-video-downloader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,coder_zoro/youtube-video-downloader"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/2514QwoqWt8CHGzjB/builds/TMrMADV3SJEXjgFXr/openapi.json
