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

Download public YouTube videos, Shorts, and live replay metadata with this Apify Actor. Extract direct stream URLs, MP4/WebM formats, transcripts, thumbnails, and channel data, then optionally save the best progressive file for automation and scalable content workflows.

- **URL**: https://apify.com/eunit/youtube-video-downloader.md
- **Developed by:** [Emmanuel Uchenna](https://apify.com/eunit) (community)
- **Categories:** Videos, Automation, Developer tools
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $19.00 / 1,000 single result in the default dataset.s

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

### What does YouTube Video Downloader do?

**YouTube Video Downloader** is an SEO-friendly [Apify](https://apify.com/) Actor for **downloading public YouTube video metadata, format URLs, Shorts data, and live replay details at scale**. It processes public [YouTube](https://www.youtube.com/) URLs with the **Apify SDK for TypeScript**, extracts downloadable MP4/WebM stream information, optional transcript data, thumbnails, and channel metadata, and can optionally save one best progressive file into the run's default key-value store.

If you need to **download YouTube video metadata with an API**, automate **YouTube Shorts downloader** workflows, or prepare reusable media records for internal tools, this Actor is built for it. You can run it from Apify Console, API, schedules, webhooks, or integrations, with dataset exports and scalable automation around a simple JSON input.

### Why use YouTube Video Downloader?

This Actor is useful when you need a repeatable way to:

1. Validate public YouTube URLs before downstream processing.
2. Collect downloadable stream metadata for content operations, archiving, or internal tooling.
3. Save one progressive file copy for approved public content workflows.
4. Capture transcripts and video metadata for search, indexing, or QA pipelines.
5. Monetize a Store Actor with predictable **pay-per-event (PPE)** behavior tied to dataset output and optional file export.

### How to use YouTube Video Downloader

1. Open the Actor in Apify Console.
2. Paste one or more public YouTube URLs into **YouTube video URLs**.
3. Choose whether you want **format URLs only** or to **save the best progressive file**.
4. Adjust quality, container, transcript capture, and format limits as needed.
5. Start the run and inspect the dataset plus saved files in the default key-value store.

### Input

Use the **Input** tab in Apify Console. The main fields are:

1. **YouTube video URLs**: public watch, Shorts, or live replay URLs.
2. **Max videos**: caps how many URLs are processed in one run.
3. **Preferred quality**: guides the optional saved file selection.
4. **Preferred container**: filters MP4 or WebM results.
5. **Include progressive/adaptive formats**: controls output breadth.
6. **Download mode**: either return metadata only or save one progressive file.
7. **Include transcript**: fetch public transcript text when available.
8. **Max saved file size (MB)**: prevents large in-memory exports.

Example input:

```json
{
  "startUrls": [
    { "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }
  ],
  "maxVideos": 5,
  "preferredQuality": "720p",
  "preferredContainer": "mp4",
  "includeProgressiveFormats": true,
  "includeAdaptiveFormats": true,
  "downloadMode": "save-best-progressive",
  "includeTranscript": true,
  "maxDownloadSizeMb": 150
}
````

### Output

Each dataset item represents one input URL. Successful items include metadata, direct format URLs, and optional saved-file details. You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

```json
[
  {
    "status": "downloaded",
    "inputUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "canonicalUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "videoId": "dQw4w9WgXcQ",
    "mediaType": "Video",
    "title": "Rick Astley - Never Gonna Give You Up (Official Music Video)",
    "durationSeconds": 213,
    "viewCount": 123456789,
    "thumbnailUrl": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
    "formats": [
      {
        "itag": 18,
        "container": "mp4",
        "streamType": "progressive",
        "qualityLabel": "360p",
        "downloadUrl": "https://..."
      }
    ],
    "selectedDownload": {
      "key": "download-rick-astley-never-gonna-give-you-up-official-music-video-dQw4w9WgXcQ.mp4",
      "publicUrl": "https://api.apify.com/v2/key-value-stores/...",
      "container": "mp4",
      "bytes": 18452133
    }
  }
]
```

### Data table

| Field | Description |
| --- | --- |
| `status` | `ready`, `downloaded`, or `error` |
| `videoId` | Normalized YouTube video ID |
| `title` | Video title from YouTube metadata |
| `mediaType` | Video, Short, or Live replay |
| `formats` | Returned download format metadata and expiring direct URLs |
| `selectedDownload` | Saved file details when file export is enabled |
| `transcript` | Public transcript data when available and requested |

### FAQ, disclaimers, and support

This Actor is intended for **public YouTube content** that you own, are licensed to use, or are otherwise authorized to process. Make sure your use complies with YouTube terms, copyright rules, and local law.

Direct format URLs returned by YouTube are typically **time-limited**. If you need durable access, use the saved-file mode and fetch the file from the run's key-value store instead.

Some videos may not expose transcripts, progressive formats, or playable streams in every context. In those cases the Actor returns a structured error item instead of failing the whole run.

If you publish this Actor to Apify Store, use the **Issues** tab for support and feedback. If you need a custom downloader or a larger content-processing pipeline, this project is a good base for extending the workflow.

# Actor input Schema

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

Public YouTube watch, Shorts, or live replay URLs to process.

## `maxVideos` (type: `integer`):

Maximum number of input URLs to process in one run.

## `preferredQuality` (type: `string`):

Used when selecting the optional saved file. Works with values like best, bestefficiency, 360p, 720p, or 1080p.

## `preferredContainer` (type: `string`):

Filter returned formats by file container and guide the optional file export.

## `includeProgressiveFormats` (type: `boolean`):

Include video+audio formats in the dataset output.

## `includeAdaptiveFormats` (type: `boolean`):

Include video-only and audio-only formats in the dataset output.

## `maxFormatsPerVideo` (type: `integer`):

Maximum number of downloadable format rows returned for each video.

## `downloadMode` (type: `string`):

Choose whether the Actor should only return download URLs or also save one best progressive file to the default key-value store.

## `includeTranscript` (type: `boolean`):

Attempt to include the public transcript when available.

## `maxDownloadSizeMb` (type: `integer`):

Safety limit for the optional saved file to avoid very large in-memory downloads.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    }
  ],
  "maxVideos": 10,
  "preferredQuality": "best",
  "preferredContainer": "any",
  "includeProgressiveFormats": true,
  "includeAdaptiveFormats": true,
  "maxFormatsPerVideo": 8,
  "downloadMode": "metadata-only",
  "includeTranscript": false,
  "maxDownloadSizeMb": 150
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `files` (type: `string`):

No description

# 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=dQw4w9WgXcQ"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("eunit/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=dQw4w9WgXcQ" }] }

# Run the Actor and wait for it to finish
run = client.actor("eunit/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 '{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    }
  ]
}' |
apify call eunit/youtube-video-downloader --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Youtube Video Downloader",
        "description": "Download public YouTube videos, Shorts, and live replay metadata with this Apify Actor. Extract direct stream URLs, MP4/WebM formats, transcripts, thumbnails, and channel data, then optionally save the best progressive file for automation and scalable content workflows.",
        "version": "0.0",
        "x-build-id": "hlcXr1Rg45pxS3LAp"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/eunit~youtube-video-downloader/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-eunit-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/eunit~youtube-video-downloader/runs": {
            "post": {
                "operationId": "runs-sync-eunit-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/eunit~youtube-video-downloader/run-sync": {
            "post": {
                "operationId": "run-sync-eunit-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": [
                    "startUrls"
                ],
                "properties": {
                    "startUrls": {
                        "title": "YouTube video URLs",
                        "type": "array",
                        "description": "Public YouTube watch, Shorts, or live replay URLs to process.",
                        "default": [
                            {
                                "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
                            }
                        ],
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "maxVideos": {
                        "title": "Max videos",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Maximum number of input URLs to process in one run.",
                        "default": 10
                    },
                    "preferredQuality": {
                        "title": "Preferred quality",
                        "enum": [
                            "best",
                            "bestefficiency",
                            "144p",
                            "240p",
                            "360p",
                            "480p",
                            "720p",
                            "1080p"
                        ],
                        "type": "string",
                        "description": "Used when selecting the optional saved file. Works with values like best, bestefficiency, 360p, 720p, or 1080p.",
                        "default": "best"
                    },
                    "preferredContainer": {
                        "title": "Preferred container",
                        "enum": [
                            "any",
                            "mp4",
                            "webm"
                        ],
                        "type": "string",
                        "description": "Filter returned formats by file container and guide the optional file export.",
                        "default": "any"
                    },
                    "includeProgressiveFormats": {
                        "title": "Include progressive formats",
                        "type": "boolean",
                        "description": "Include video+audio formats in the dataset output.",
                        "default": true
                    },
                    "includeAdaptiveFormats": {
                        "title": "Include adaptive formats",
                        "type": "boolean",
                        "description": "Include video-only and audio-only formats in the dataset output.",
                        "default": true
                    },
                    "maxFormatsPerVideo": {
                        "title": "Max formats per video",
                        "minimum": 1,
                        "maximum": 30,
                        "type": "integer",
                        "description": "Maximum number of downloadable format rows returned for each video.",
                        "default": 8
                    },
                    "downloadMode": {
                        "title": "Download mode",
                        "enum": [
                            "metadata-only",
                            "save-best-progressive"
                        ],
                        "type": "string",
                        "description": "Choose whether the Actor should only return download URLs or also save one best progressive file to the default key-value store.",
                        "default": "metadata-only"
                    },
                    "includeTranscript": {
                        "title": "Include transcript",
                        "type": "boolean",
                        "description": "Attempt to include the public transcript when available.",
                        "default": false
                    },
                    "maxDownloadSizeMb": {
                        "title": "Max saved file size (MB)",
                        "minimum": 10,
                        "maximum": 1024,
                        "type": "integer",
                        "description": "Safety limit for the optional saved file to avoid very large in-memory downloads.",
                        "default": 150
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
