# YouTube Video Downloader — MP4, MP3, Shorts, Playlists (`confidential_gnat/youtube-video-downloader`) Actor

Download YouTube videos, Shorts, playlists and channels as MP4, MKV, WebM, AVI, MOV or audio (MP3, M4A, WAV, FLAC) in 360p to 4K. Get subtitles, transcript and metadata, plus direct download links in Apify, S3 or Azure storage. Repeat downloads are skipped.

- **URL**: https://apify.com/confidential_gnat/youtube-video-downloader.md
- **Developed by:** [ActorFlow](https://apify.com/confidential_gnat) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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 Video Downloader — MP4, MP3, Shorts, Playlists & Channels

**Download YouTube videos (youtube.com)** as **MP4, MKV, WebM, AVI or MOV** in **360p to 4K**, or extract **audio as MP3, M4A, Opus, WAV or FLAC**. Works with single videos, **Shorts, playlists and channels**, and adds **subtitles, a transcript and full metadata**. Files are saved to **Apify storage, S3-compatible storage or Azure** with a direct download link, and results export as **JSON, CSV or Excel** or through the **API**. Paste a link, press Start; give a **cache project name** and a video you already downloaded is returned instantly without a new download or charge.

**Target website:** [youtube.com](https://www.youtube.com)

### ✨ Features of this YouTube video downloader

- **Video downloads in 360p to 4K** — choose the highest height (360, 480, 720, 1080, 1440 or 2160); you get the best quality up to it
- **Many formats** — MP4, MKV and WebM are made by combining the streams (fast); AVI and MOV are converted
- **Audio extraction** — MP3, M4A, Opus, WAV or FLAC; audio-only runs download only the audio stream
- **Audio language** — pick a track by 2-letter language code when a video has several
- **Shorts, playlists and channels** — links to Shorts, embeds, `youtu.be`, playlists and `@channel` pages; set how many of the newest videos to take from each list
- **Subtitles and transcript** — download subtitles as `.srt` files in the languages you choose, optionally with automatic captions, plus the transcript as plain text
- **Full metadata** — title, description, duration, uploader, channel, upload date, views, likes, tags, categories, thumbnail, resolution, frame rate and codecs, and optionally the complete list of available streams
- **Choose where files go** — Apify storage (no setup), S3-compatible storage (AWS S3, DigitalOcean Spaces, Google Cloud Storage, Cloudflare R2) or Azure Blob Storage
- **Custom file names** — build names from title, uploader, upload date and quality; the video ID is always added
- **Cache project** — name a cache project and the same video with the same options is returned from storage without a new download or charge; set retention days to delete old files automatically
- **Size and length limits** — videos over your limits are skipped without charge
- **Parallel downloads** — several videos at once, with automatic retries on a new connection when YouTube blocks one
- **Proxy and cookies support** — residential Apify proxy by default, your own proxy, or your own YouTube cookies
- **Clear progress log** — each download, its progress, every skipped video and every retry is logged

### 🚀 How to download YouTube videos in 5 steps

1. [Sign up](https://apify.com/sign-up) for a free Apify account — includes **$5 monthly credit**.

2. Open the actor page and click **Try for free**.

3. Paste YouTube links in the **Input** tab and choose a format and quality.

4. Click **Start** and wait for the run to complete.

5. Open the **Output** tab and use the **Download** link of each video, or export the list as JSON, CSV or Excel.

6. **YouTube URLs** — paste video, Shorts, playlist or channel links, for example `https://www.youtube.com/watch?v=jNQXAC9IVRw`. Use **Add** for one at a time, **Bulk edit** for many, or **Text file** to load a list.

7. **Format and Video quality** — for example MP4 at 720p, or MP3 for audio only.

8. **Max videos per playlist or channel** — how many of the newest videos to take from each list.

9. **Storage** — Apify storage needs no setup. Pick S3 or Azure and fill in its settings to save files to your own bucket.

10. **Cache project name** — optional. Enter any name (for example `my-downloads`) and repeat requests for the same video and options are served from storage at no charge.

You can also run this actor via the [Apify API](https://docs.apify.com/api/v2) or integrate it directly into your workflows using [Zapier](https://zapier.com/apps/apify), [Make](https://www.make.com/), or [n8n](https://n8n.io/).

### 💰 Pricing

This actor uses **pay-per-event** billing: a fixed price for each video downloaded plus a price for each started minute of video. You are not charged for cache hits, skipped videos (too long or too large) or failed downloads.

- New Apify accounts include **$5 of free monthly credit**.
- **Apify proxy traffic is billed separately by Apify per GB.** YouTube blocks most server addresses, so the default is residential proxy, and the whole video passes through it. Audio-only downloads and lower qualities use much less traffic.
- Files in Apify storage use storage space. A normal run's files follow your plan's retention; a cache project keeps its files until you delete them or the retention days pass.

### 🔧 Input configuration

| Field | Type | Required | Default | Description |
| ----- | ---- | -------- | ------- | ----------- |
| YouTube URLs (`startUrls`) | array | — | A sample video | Videos, Shorts, playlists or channels. |
| Video IDs (`videoIds`) | array | — | — | 11-character video IDs, added to the URLs. |
| Max videos per playlist or channel (`maxItems`) | integer | — | 3 | Newest videos taken from each playlist or channel. |
| Format (`format`) | string | — | mp4 | mp4, mkv, webm, avi, mov, mp3, m4a, opus, wav, flac. |
| Video quality (`quality`) | string | — | 720 | Highest height: 360, 480, 720, 1080, 1440, 2160. |
| Audio language (`audioLanguage`) | string | — | — | 2-letter code of the audio track to prefer. |
| Subtitle languages (`subtitleLanguages`) | array | — | — | Language codes to download as `.srt`. |
| Include automatic captions (`includeAutoCaptions`) | boolean | — | false | Also use YouTube's auto-generated captions. |
| Include transcript text (`includeTranscript`) | boolean | — | false | Adds the first subtitle language as plain text. |
| Include all available formats (`includeAllFormats`) | boolean | — | false | Adds the list of all streams to the output. |
| File name parts (`filenameParts`) | array | — | title | Any of title, uploader, uploadDate, quality. |
| Storage (`storageType`) | string | — | apify | apify, s3 or azure. |
| S3 settings (`s3Bucket`, `s3AccessKeyId`, `s3SecretAccessKey`, `s3Region`, `s3Endpoint`, `s3PathPrefix`, `s3PublicBaseUrl`) | string | — | — | For S3-compatible storage. Bucket and keys are required. |
| Azure settings (`azureConnectionString`, `azureContainer`) | string | — | — | For Azure Blob Storage. Both are required. |
| Cache project name (`cacheProjectName`) | string | — | — | Returns repeat downloads from storage at no charge. |
| Cache retention (`retentionDays`) | integer | — | 0 | Deletes cache files older than this many days. 0 keeps them. |
| Max file size (`maxFileSizeMb`) | integer | — | 500 | Larger files are skipped. |
| Max video length (`maxDurationMinutes`) | integer | — | 120 | Longer videos and live streams are skipped. |
| Parallel downloads (`maxConcurrency`) | integer | — | 3 | Videos downloaded at the same time. |
| Proxy configuration (`proxyConfiguration`) | object | — | Residential | Apify proxy settings. |
| Custom proxy URL (`customProxyUrl`) | string | — | — | Your own proxy instead of Apify proxy. |
| YouTube cookies (`youtubeCookies`) | string | — | — | Netscape cookies.txt for videos that need a signed-in account. |

**Supported URL types:**

- Video: `https://www.youtube.com/watch?v=jNQXAC9IVRw`, `https://youtu.be/jNQXAC9IVRw`, `https://www.youtube.com/shorts/jNQXAC9IVRw`, `https://www.youtube.com/embed/jNQXAC9IVRw`
- Playlist: `https://www.youtube.com/playlist?list=PL...`
- Channel: `https://www.youtube.com/@TED` (the Videos tab; add `/shorts` for Shorts)

### 📦 YouTube video downloader output data

The output is a dataset with one record per video, all with the same fields (`null` or an empty list when a value is not available). Each record contains: `videoId`, `url`, `source`, `status` (`success`, `skipped` or `failed`), `error`, `fromCache`, `title`, `description`, `durationSeconds`, `uploader`, `channelId`, `channelUrl`, `uploadDate`, `viewCount`, `likeCount`, `commentCount`, `tags`, `categories`, `thumbnailUrl`, `format`, `quality`, `height`, `width`, `fps`, `videoCodec`, `audioCodec`, `fileName`, `fileSizeBytes`, `fileSizeMb`, `contentType`, `storageType`, `storageLocation`, `storageKey`, `downloadUrl`, `expiresAt`, `subtitles` (`language`, `fileName`, `url`), `transcript`, `formats` and `downloadedAt`. The dataset has a **Downloads** view: a table of thumbnail, title, status, format, quality, duration, size, cache flag, download link and error.

**Output at a glance:**

| Video | Status | Format | Quality | Size (MB) | From cache |
| --- | --- | --- | --- | --- | --- |
| [Me at the zoo](https://www.youtube.com/watch?v=jNQXAC9IVRw) | success | mp4 | 360p | 0.51 | No |

**Sample output (raw JSON):**

````json
{
    "videoId": "jNQXAC9IVRw",
    "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "source": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "status": "success",
    "error": null,
    "fromCache": false,
    "title": "Me at the zoo",
    "description": "Microplastics are accumulating in human brains at an alarmin...",
    "durationSeconds": 19,
    "uploader": "jawed",
    "channelId": "UC4QobU6STFB0P71PMvOGN5A",
    "channelUrl": "https://www.youtube.com/channel/UC4QobU6STFB0P71PMvOGN5A",
    "uploadDate": "2005-04-24",
    "viewCount": 440395810,
    "likeCount": 20002381,
    "commentCount": 10000000,
    "tags": [
        "me at the zoo",
        "jawed karim",
        "first youtube video"
    ],
    "categories": [
        "Film & Animation"
    ],
    "thumbnailUrl": "https://i.ytimg.com/vi/jNQXAC9IVRw/hqdefault.jpg",
    "format": "mp4",
    "quality": "360",
    "height": 240,
    "width": 320,
    "fps": 15,
    "videoCodec": "av01.0.00M.08.0.110.05.01.06.0",
    "audioCodec": "mp4a.40.2",
    "fileName": "Me_at_the_zoo_jNQXAC9IVRw.mp4",
    "fileSizeBytes": 533932,
    "fileSizeMb": 0.51,
    "contentType": "video/mp4",
    "storageType": "apify",
    "storageLocation": "<STORE_ID>",
    "storageKey": "Me_at_the_zoo_jNQXAC9IVRw.mp4",
    "downloadUrl": "https://api.apify.com/v2/key-value-stores/<STORE_ID>/records/Me_at_the_zoo_jNQXAC9IVRw.mp4?signature=...",
    "expiresAt": null,
    "subtitles": [
        {
            "language": "en",
            "fileName": "Me_at_the_zoo_jNQXAC9IVRw.en.srt",
            "url": "https://api.apify.com/v2/key-value-stores/<STORE_ID>/records/Me_at_the_zoo_jNQXAC9IVRw.en.srt?signature=..."
        }
    ],
    "transcript": null,
    "formats": null,
    "downloadedAt": "2026-10-06T00:00:00.000Z"
}```

### 🐍 How to download YouTube videos with Python, JavaScript or the API

Run the actor programmatically with the official Apify clients. Replace `<YOUR_API_TOKEN>` with the token from your [Apify Console](https://console.apify.com/account/integrations).

**Python** (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")

run = client.actor("confidential_gnat/youtube-video-downloader").call(run_input={
    "startUrls": [{"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw"}],
    "format": "mp4",
    "quality": "720",
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["title"], item["downloadUrl"])
````

**JavaScript** (`npm install apify-client`):

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

const client = new ApifyClient({ token: '<YOUR_API_TOKEN>' });

const run = await client.actor('confidential_gnat/youtube-video-downloader').call({
    startUrls: [{ url: 'https://www.youtube.com/watch?v=jNQXAC9IVRw' }],
    format: 'mp4',
    quality: "720",
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

**cURL** — start a run and wait for the dataset:

```bash
curl -X POST "https://api.apify.com/v2/acts/confidential_gnat~youtube-video-downloader/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": [{"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw"}], "format": "mp4", "quality": "720"}'
```

### 💡 What you can use YouTube video downloads for

- Building offline archives of your own channel's videos
- Extracting audio from your own podcasts, talks and recordings
- Collecting subtitles and transcripts for research and accessibility
- Feeding video files to editing, transcription and AI pipelines
- Backing up playlists and channels you manage to your own cloud storage

Content teams, researchers, educators and developers typically use this. Only download videos you own or have permission to use.

### ⚠️ Limitations & known issues

- **Proxy needed** — YouTube blocks most server addresses, so a residential proxy is the default. Without one most downloads fail.
- **Proxy cost** — the video passes through the proxy, so large videos use a lot of proxy traffic.
- **Not downloadable** — private videos, members-only videos, live streams and videos that have not started yet. Age-restricted videos need your own cookies.
- **Size and length** — videos over the file size or length limits are skipped. Very long or very high quality videos fail more often.
- **Transcripts** — the transcript comes from YouTube's captions, not speech-to-text, so a video without captions has none.
- **Direct links** — a link to a stream straight from YouTube is tied to the connection that made it, so the actor always saves the file to your storage and gives you that link.
- **Conversions** — AVI and MOV are converted, which takes longer than MP4, MKV or WebM.
- **Link lifetime** — S3 and Azure links are private signed links valid for 7 days unless you set a public base URL.

### ❓ Frequently asked questions

#### Can I download YouTube videos legally?

The actor only accesses videos that are publicly available on YouTube — no private video is opened. Downloading videos can still conflict with YouTube's Terms of Service and with the copyright of the video's owner, so only download content you own or have permission to use, and make sure you comply with applicable laws.

#### What data does the YouTube video downloader return?

The video or audio file with a download link, plus title, description, duration, uploader, channel, upload date, views, likes, tags, categories, thumbnail, resolution, codecs, file size and subtitle links. Optional: transcript text and the list of all available streams.

#### How many videos can I download from one playlist or channel?

`maxItems` limits how many of the newest videos are taken from each playlist or channel link. Single video links are always downloaded.

#### Do I need a proxy to download from youtube.com?

Yes. The input defaults to residential Apify proxy because YouTube blocks most server addresses. You can use your own proxy, and your own cookies for videos that need a signed-in account.

#### How do I download YouTube videos with Python?

Use the Python example above: call the actor with the Apify client, then iterate over the dataset items and use each `downloadUrl`.

#### Can I run this YouTube video downloader on a schedule?

Yes, use Apify Schedules. Set the same **Cache project name** on every run and a video you already downloaded with the same format and quality is returned from storage without a new download or charge. Set **Cache retention** to delete old files automatically.

#### What output formats are supported?

Videos: MP4, MKV, WebM, AVI, MOV. Audio: MP3, M4A, Opus, WAV, FLAC. The run's results can be exported as JSON, CSV, Excel, XML and RSS from the **Output** tab or through the Apify API.

#### Why was my video skipped or did it fail?

The `status` and `error` fields say why: a skipped video was longer or larger than your limits or was a live stream; a failed video was private, unavailable, age-restricted, or blocked after several retries. Skipped and failed videos are not charged.

### 🔗 Other actors you may find useful

| Actor | Description |
| ----- | ----------- |
| [▶️ YouTube Video List Scraper](https://apify.com/confidential_gnat/youtube-video-list-scraper) | Lists the videos of YouTube channels and playlists. |
| [📊 YouTube Channel Info and Stats](https://apify.com/confidential_gnat/youtube-channel-info-and-stats) | Channel details and statistics from YouTube. |

### 💬 Support & contact

If you encounter any issues or have questions, please [open an issue](https://apify.com/confidential_gnat/youtube-video-downloader/issues/open) or reach out via the [Apify Community Forum](https://community.apify.com/).

You can also find more of our actors on the [Actor Flow](https://apify.com/confidential_gnat) page.

# Actor input Schema

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

Video links (youtube.com/watch, youtu.be, Shorts, embed), playlists (youtube.com/playlist?list=...) or channels (youtube.com/@name). Playlists and channels download their newest videos, up to the limit below.

## `videoIds` (type: `array`):

Optional. YouTube video IDs (the 11 characters after v=), for example jNQXAC9IVRw. Added to the URLs above.

## `maxItems` (type: `integer`):

How many of the newest videos to download from each playlist or channel URL. Single video links are always downloaded.

## `format` (type: `string`):

File type. MP4, MKV and WebM only combine the video and audio streams, which is fast. AVI and MOV convert the video, which takes longer. MP3, M4A, Opus, WAV and FLAC download audio only.

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

The highest video height to download, in pixels. If the video is smaller you get its best quality. Ignored for audio formats.

## `audioLanguage` (type: `string`):

Optional. Two-letter language code (for example en, es, fr) to pick that audio track when a video has several. Falls back to the default track.

## `subtitleLanguages` (type: `array`):

Optional. Language codes of subtitles to download as .srt files, for example \["en", "es"]. Leave empty for no subtitles.

## `includeAutoCaptions` (type: `boolean`):

Also download YouTube's auto-generated captions when a video has no uploaded subtitles in the languages above.

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

Adds the subtitles of the first language as plain text in the output (needs a subtitle language above). Uses YouTube's own captions, not speech-to-text.

## `includeAllFormats` (type: `boolean`):

Adds the full list of streams YouTube offers for each video (resolution, codecs, bitrate, size, language) to the output. The download itself is not affected.

## `filenameParts` (type: `array`):

Which details go into the file name, in order. The video ID is always added at the end. Allowed: title, uploader, uploadDate, quality.

## `storageType` (type: `string`):

Where the files are saved. Apify storage needs no setup and gives a download link (files of a normal run are kept for the retention time of your Apify plan; files in a cache project are kept until you delete them or the retention days pass).

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

Needed for S3-compatible storage.

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

Needed for S3-compatible storage.

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

Needed for S3-compatible storage.

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

Optional. For example us-east-1 (the default).

## `s3Endpoint` (type: `string`):

Optional. Only for services other than AWS, for example https://nyc3.digitaloceanspaces.com, https://storage.googleapis.com or your Cloudflare R2 address.

## `s3PathPrefix` (type: `string`):

Optional. Folder inside the bucket, ending with a slash, for example youtube/.

## `s3PublicBaseUrl` (type: `string`):

Optional. If the bucket is public (or behind a CDN), links are built from this address. Otherwise links are private signed links valid for 7 days.

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

Needed for Azure Blob Storage.

## `azureContainer` (type: `string`):

Needed for Azure Blob Storage. Created if it does not exist.

## `cacheProjectName` (type: `string`):

Optional. Downloads are kept in a named storage under this name. When the same video is requested again with the same format, quality and options, the saved file is returned at once and you are not charged again. Use the same name on each run. Leave empty to download everything fresh.

## `retentionDays` (type: `integer`):

With a cache project: files older than this many days are deleted at the start of the next run. 0 keeps them until you delete them.

## `maxFileSizeMb` (type: `integer`):

Videos whose file would be larger are skipped without charge.

## `maxDurationMinutes` (type: `integer`):

Longer videos and live streams are skipped without charge.

## `maxConcurrency` (type: `integer`):

How many videos are downloaded at the same time. Raise it with more memory.

## `proxyConfiguration` (type: `object`):

YouTube blocks most server addresses, so residential Apify proxy is the default. Proxy traffic is billed by Apify per GB.

## `customProxyUrl` (type: `string`):

Optional. Use your own proxy instead of Apify proxy, for example http://user:password@host:port.

## `youtubeCookies` (type: `string`):

Optional. Cookies in Netscape cookies.txt format, for videos that need a signed-in account (for example age-restricted videos). Use a throwaway account: YouTube may restrict accounts used for downloading.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw"
    }
  ],
  "videoIds": [],
  "maxItems": 3,
  "format": "mp4",
  "quality": "720",
  "subtitleLanguages": [],
  "includeAutoCaptions": false,
  "includeTranscript": false,
  "includeAllFormats": false,
  "filenameParts": [
    "title"
  ],
  "storageType": "apify",
  "retentionDays": 0,
  "maxFileSizeMb": 500,
  "maxDurationMinutes": 120,
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `overview` (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=jNQXAC9IVRw"
        }
    ],
    "videoIds": [],
    "maxItems": 3,
    "subtitleLanguages": [],
    "filenameParts": [
        "title"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("confidential_gnat/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=jNQXAC9IVRw" }],
    "videoIds": [],
    "maxItems": 3,
    "subtitleLanguages": [],
    "filenameParts": ["title"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("confidential_gnat/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=jNQXAC9IVRw"
    }
  ],
  "videoIds": [],
  "maxItems": 3,
  "subtitleLanguages": [],
  "filenameParts": [
    "title"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call confidential_gnat/youtube-video-downloader --silent --output-dataset

```

## MCP server setup

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