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

Use YouTube Video Downloader to download YouTube videos in MP4, MP3, avi, and other formats directly to your cloud storage service.  Just add a YouTube video URL and get the converted video in a few seconds.

- **URL**: https://apify.com/streamers/youtube-video-downloader.md
- **Developed by:** [Streamers](https://apify.com/streamers) (Apify)
- **Categories:** Videos, Social media
- **Stats:** 24,345 total users, 1,160 monthly users, 99.8% runs succeeded, 88 bookmarks
- **User rating**: 4.26 out of 5 stars

## Pricing

from $2.50 / 1,000 video download of 1mbs

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

### What is YouTube Video Downloader?

YouTube Video Downloader is a powerful and easy-to-use tool for **downloading YouTube videos and converting them to MP4, MP3, AVI, and other formats**. This tool allows you to enter the name under which you want the video to be downloaded, your preferred quality, and your preferred format. All you need is a URL and an access key to your AWS S3, Azure, or Google Cloud storage.

### How to download a YouTube video?

YouTube Video Downloader is designed to be user-friendly, even for those who have never downloaded YouTube videos before. Here’s how you can use YouTube video downloader online:

1. [Create](https://console.apify.com/actors/UUhJDfKJT2SsXdclR) a free Apify account using your email.
2. Open [YouTube Video Downloader](https://apify.com/streamers/youtube-video-downloader)
3. Add video URL you want to download.
4. Fill in your storage access key.
5. Click the “Start” button and wait for the YouTube video to be downloaded.

### 🔼Input sample

The input for online YouTube Video Downloader should be one or multiple YouTube **video URLs.** See the input example below.

Go to the [input tab](https://apify.com/streamers/youtube-video-downloader/input-schema) for a full explanation of a JSON input example.

### 🔽Output sample

The videos downloaded from YouTube will be stored directly in your preferred cloud storage service. You can choose from:

- AWS S3
- Azure Storage
- Google Cloud Storage

### Integrate YouTube Video Downloader and automate your workflow

Last but not least, YouTube Video Downloader can be connected with almost any cloud service or web app thanks to [integrations](https://apify.com/integrations) on the Apify platform.

These include:

- [Make](https://docs.apify.com/platform/integrations/make)
- [Zapier](https://docs.apify.com/platform/integrations/zapier)
- [Slack](https://docs.apify.com/platform/integrations/slack)
- [Airbyte](https://docs.apify.com/platform/integrations/airbyte)
- [GitHub](https://docs.apify.com/platform/integrations/github)
- [Google Drive](https://docs.apify.com/platform/integrations/drive)
- and [much more](https://docs.apify.com/platform/integrations).

Alternatively, you can use [webhooks](https://docs.apify.com/platform/integrations/webhooks) to carry out an action whenever an event occurs. For example, you can get a notification whenever YouTube Video Downloader successfully finishes a run.

### Scrape any YouTube data you need with dedicated scrapers

You can use the dedicated scrapers below if you want to **scrape specific YouTube data**. Each of them is built particularly for the relevant YouTube data scraping case, be it shorts, comments, or all data at once. Feel free to browse them:

<table border="1" cellpadding="10">
<tr>
<td>🔍 <a href="[https://apify.com/streamers/youtube-scraper](https://apify.com/streamers/youtube-scraper)">YouTube Scraper</a></td>
<td>🎮 <a href="[https://apify.com/streamers/youtube-shorts-scraper](https://apify.com/streamers/youtube-shorts-scraper)">YouTube Shorts Scraper</a></td>
<td>💬 <a href="[https://apify.com/streamers/youtube-comments-scraper](https://apify.com/streamers/youtube-comments-scraper)">YouTube Comments Scraper</a></td>
</tr>
<tr>
<td>⚡ <a href="[https://apify.com/streamers/youtube-channel-scraper](https://apify.com/streamers/youtube-channel-scraper)">Fast YouTube Channel Scraper</a></td>
</tr>
</table>

You can also combine YouTube data with that from other social networks. For example you can gather data with our [TikTok scrapers](https://apify.com/clockworks), [Instagram scrapers](https://apify.com/store/categories?search=instagram\&managedBy=APIFY), [Facebook scrapers](https://apify.com/store/categories?search=facebook\&managedBy=APIFY), and other [social media scrapers](https://apify.com/store?category=SOCIAL_MEDIA).

Furthermore, you can use the power of AI agents to do multiple tasks at one. For example, our [Comments Analyzer Agent](https://apify.com/apify/comments-analyzer-agent) can perform sentiment analysis of YouTube videos, or you could try our [Influencer Discovery Agent](https://apify.com/apify/influencer-discovery-agent) for lead generation on TikTok videos.

### Not your cup of tea? Build your own scraper.

YouTube Video Downloader doesn’t exactly do what you need?

You can always build your own! Use one of [scraper templates](https://apify.com/templates) in Python, JavaScript, and TypeScript to get started.

Alternatively, you can write it from scratch using our [open-source library Crawlee](https://crawlee.dev/). You can keep the scraper to yourself or make it public by adding it to Apify Store and [start making money](https://blog.apify.com/how-to-scrape-tiktok-tutorial/) on it.

Or let us know if you need a [custom scraping solution](https://apify.com/custom-solutions).

### Your feedback

We’re always working on improving the performance of our Actors. So if you’ve got any technical feedback for YouTube Video Downloader or simply found a bug, please create an issue on the Actor’s [Issues tab](https://apify.com/streamers/youtube-video-downloader/issues/open) in Apify Console.

### ❓FAQ

#### How much does it cost to use YouTube Video Downloader?

YouTube Video Downloader uses our [pay-per-event (PPE) model](https://help.apify.com/en/articles/10700066-what-is-pay-per-event), meaning you pay for specific actions of the Actor. If you’re on the free plan, you pay $0.006 every time you start the actor, and another $0.06 for every 10MB of video you’ve downloaded.

If you subscribe to our paid plans, these numbers will fall thanks to discounts; read all the details in the Actor’s [pricing tab](https://apify.com/streamers/youtube-video-downloader/pricing).

#### How can I use YouTube Video Downloader with the Apify API?

The Apify API gives you programmatic access to the Apify platform. [The API](https://apify.com/clockworks/tiktok-user-search-scraper/api/python) is organized around RESTful HTTP endpoints that enable you to manage, schedule, and run Apify actors. The API also lets you access any datasets, monitor actor performance, fetch results, create and update versions, and more.

To access the API using Node.js, use the `apify-client` NPM package. To access the API using Python, use the `apify-client` PyPI package.

Check out the [Apify API reference](https://docs.apify.com/api/v2) docs for full details or click on the [YouTube Video Downloader API tab](https://apify.com/streamers/youtube-video-downloader/api/python) for code examples.

#### Can I use YouTube Scraper through an MCP Server?

With Apify API, you can use almost any Actor in conjunction with an MCP server. You can connect to the MCP server using clients like ClaudeDesktop and LibreChat, or even build your own. Read all about how you can [set up Apify Actors with MCP](https://blog.apify.com/how-to-use-mcp/).

For YouTube Scraper, go to the [MCP tab](https://apify.com/streamers/youtube-video-downloader/api/mcp) and then go through the following steps:

1. Start a Server-Sent Events (SSE) session to receive a `sessionId`
2. Send API messages using that `sessionId` to trigger the scraper
3. The message starts the Amazon ASINs Scraper with the provided input
4. The response should be: `Accepted`

# Changelog

This Actor's version history is a separate document: https://apify.com/streamers/youtube-video-downloader/changelog.md

# Actor input Schema

## `videos` (type: `array`):

A list of video urls

## `storeInKVStore` (type: `boolean`):

Instead of a cloud storage, you can download the videos to Apify Storage. **IMPORTANT**: The storage is owned by Apify and the videos in it will be deleted after ~3 days. Links to videos are pushed to the dataset.

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

Optional quality, may require more time to process if > 720p

## `preferredFormat` (type: `string`):

Optional format, may require more time to process. For now only video formats are supported, but audio-only formats will be added in the future

## `filenameTemplateParts` (type: `array`):

Specifies what video info to include in the filename. Each part will be separated by an underscore. Video ID is always included at the start, and if the title of the video is too long, the whole filename will be truncated to 252 characters. When downloading to Apify's Key-Value Store, will transliterate the filename to ASCII characters, if needed.

## `s3AccessKeyId` (type: `string`):

Access key ID for the S3 bucket

## `s3SecretAccessKey` (type: `string`):

Secret access key for the S3 bucket

## `s3Bucket` (type: `string`):

Name of the S3 bucket. Must be created by you.

## `s3Region` (type: `string`):

Region of the S3 bucket. E.g. 'us-west-1'

## `azureConnectionString` (type: `string`):

Connection string for the Azure Blob Storage

## `azureContainerName` (type: `string`):

Name of the Azure container. Will be auto-created if doesn't exist

## `googleCloudServiceKey` (type: `string`):

Service account's key JSON object for the Google Cloud Storage

## `googleCloudBucketName` (type: `string`):

Name of the Google Cloud bucket. Must be created by you

## `transcriptionAndSubtitle` (type: `string`):

Choose how to handle subtitles and audio transcription for input videos. Subtitles are provided by YouTube for some videos, and transcription means that this Actor will use speech-to-text AI to generate video transcript. Transcripts are charged as an extra event according to your plan.

## Actor input object example

```json
{
  "videos": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    }
  ],
  "preferredQuality": "720p",
  "preferredFormat": "mp4",
  "filenameTemplateParts": [
    "title"
  ],
  "s3Bucket": "my-video-bucket",
  "s3Region": "us-west-1",
  "azureContainerName": "my-video-container",
  "googleCloudBucketName": "my-video-bucket",
  "transcriptionAndSubtitle": "ALWAYS_TRANSCRIBE"
}
```

# Actor output Schema

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

Dataset containing all downloaded video data

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

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

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

```

## MCP server setup

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