# 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:** 28 total users, 6 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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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(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=dQw4w9WgXcQ"
    }
  ]
}' |
apify call eunit/youtube-video-downloader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,eunit/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/ap9k9oIlQYNzN9gi6/builds/hlcXr1Rg45pxS3LAp/openapi.json
