# Video or Audio Downloader (`reinventingai/video-or-audio-downloader`) Actor

Download videos or extract audio from YouTube, TikTok, Instagram, X, Reddit, Vimeo, and 1000+ sites. Returns MP4/MP3 files with direct download URLs, metadata, and thumbnails. Supports cookie authentication for protected content and Standby mode for real-time API. Download videos easily and fast!

- **URL**: https://apify.com/reinventingai/video-or-audio-downloader.md
- **Developed by:** [Mark Fulton](https://apify.com/reinventingai) (community)
- **Categories:** Social media, Videos, Automation
- **Stats:** 2 total users, 1 monthly users, 50.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $40.00 / 1,000 successful downloads

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

## Video Downloader

An Apify Actor that downloads videos and extracts audio from over 1,000 supported websites including **YouTube, TikTok, Instagram, Twitter/X, Reddit, Vimeo, and Twitch**.

Powered by `yt-dlp` and `ffmpeg`.

### What it does

- Download videos as **MP4** or extract audio as **MP3**
- Automatically fetch the best available quality, or specify a maximum resolution (e.g., `1080p`, `720p`)
- Process single URLs or bulk process a list of links
- Files are saved directly to the Apify Key-Value store with direct download links provided in the output
- Serves download requests dynamically via **Apify Standby Mode**

### Supported Sites

Anything [yt-dlp supports](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md), including:

YouTube, TikTok, Instagram, Twitter/X, Reddit, Facebook, Vimeo, Twitch, Dailymotion, SoundCloud, Loom, Streamable, Pinterest, Tumblr, Threads, LinkedIn, and many more.

### Input

```json
{
  "url": "https://www.tiktok.com/@vmmystery/video/7624238786251148576",
  "format": "video",
  "quality": "best"
}
````

#### Input Fields

> **YouTube note:** For YouTube downloads, you will typically need to provide the **Cookies.txt** field and enable **Apify Proxy**.

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `url` | string | Yes (or `urls`) | Single video URL to download |
| `urls` | array | Yes (or `url`) | Array of video URLs to download |
| `format` | string | No | `"video"` (MP4) or `"audio"` (MP3). Default: `"video"` |
| `quality` | string | No | `"best"`, `"1080p"`, `"720p"`, `"480p"`, `"360p"`. Default: `"best"` |
| `cookies` | string | No | Paste your cookies.txt file contents here (Netscape format) for authentication, especially for YouTube |
| `useApifyProxy` | boolean | No | Enable Apify Proxy. For YouTube, this should typically be turned on together with `cookies` |

### YouTube Bot Protection

If you encounter the error:

```
Sign in to confirm you're not a bot
```

You need to provide your YouTube cookies.

#### How to export cookies correctly

**Step 1: Install browser extension**

- **Chrome:** [Get cookies.txt CLEAN](https://chromewebstore.google.com/detail/get-cookiestxt-clean/ahmnmhfbokciafffnknlekllgcnafnie)
- **Firefox:** [cookies.txt](https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/)

**Step 2: Export YouTube cookies**

1. Visit **youtube.com** while logged in
2. Click the extension icon
3. Export cookies for **youtube.com** (make sure it says youtube.com, not a specific video URL)
4. Open the downloaded `cookies.txt` file in a **plain text editor** (Notepad, TextEdit, VS Code—NOT Word or Google Docs)
5. Copy the **entire contents** exactly as-is

**Step 3: Paste into the Cookies field**

In the Actor input form, paste the entire contents into the **Cookies (Netscape format)** textarea field.

**Important:**

- The file must start with `## Netscape HTTP Cookie File` or `## HTTP Cookie File`
- Each cookie line should be tab-separated (not spaces)
- Make sure you're logged into YouTube when you export the cookies
- Fresh cookies work best—if your cookies are old, export new ones

**Example:**

```json
{
  "url": "https://www.youtube.com/watch?v=QPCu4jL3oPI",
  "format": "video",
  "quality": "480p",
  "cookies": "## Netscape HTTP Cookie File\n.youtube.com\tTRUE\t/\tFALSE\t1234567890\tCONSENT\tYES+...\n.youtube.com\tTRUE\t/\tTRUE\t1234567890\t__Secure-3PSID\t...\n..."
}
```

### Example Output

```json
{
  "requestedUrl": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "title": "Me at the zoo",
  "duration": 19,
  "uploader": "jawed",
  "thumbnail": "https://i.ytimg.com/vi/jNQXAC9IVRw/maxresdefault.jpg",
  "platform": "youtube",
  "format": "video",
  "media": {
    "key": "media-youtube-com-1716163200000-ab12cd34.mp4",
    "url": "https://api.apify.com/v2/key-value-stores/STORE_ID/records/media-youtube-com-1716163200000-ab12cd34.mp4",
    "contentType": "video/mp4"
  },
  "downloadedAt": "2026-05-20T02:00:00.000Z"
}
```

The `media.url` field provides a direct download link to the file stored in Apify's Key-Value store.

### Bulk Downloads

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "https://vimeo.com/22439234",
    "https://www.tiktok.com/@username/video/123456"
  ],
  "format": "video",
  "quality": "720p"
}
```

### Extract Audio Only

```json
{
  "url": "https://www.tiktok.com/@vmmystery/video/7624238786251148576",
  "format": "audio"
}
```

Returns an MP3 file instead of MP3.

### Standby Mode

The actor supports Apify Standby Mode for real-time requests:

```bash
curl -X POST https://YOUR_ACTOR_STANDBY_URL/download \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.youtube.com/watch?v=...","format":"video"}'
```

Or via GET:

```
https://YOUR_ACTOR_STANDBY_URL/download?url=https://www.youtube.com/watch?v=...&format=audio
```

### Disclaimer

This tool is intended for personal use only. Please respect copyright laws and the terms of service of the platforms you download from. The developers are not responsible for any misuse of this tool.

### License

MIT

# Actor input Schema

## `url` (type: `string`):

A single video URL to download (YouTube, TikTok, Twitter/X, Instagram, etc). Note: for YouTube downloads, you will typically need both the Cookies.txt field and Apify Proxy enabled.

## `urls` (type: `array`):

Optional list of URLs to download in sequence.

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

Download as MP4 video or extract MP3 audio.

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

Maximum resolution for video downloads.

## `cookies` (type: `string`):

For YouTube downloads, this is typically required. Export cookies using Get cookies.txt CLEAN (Chrome: https://chromewebstore.google.com/detail/get-cookiestxt-clean/ahmnmhfbokciafffnknlekllgcnafnie | Firefox: https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/), then paste the entire file contents here.

## `useApifyProxy` (type: `boolean`):

Enable Apify Proxy for downloads. For YouTube, this should typically be turned on together with the Cookies.txt field because YouTube often blocks datacenter IPs.

## `apifyProxyGroups` (type: `array`):

Optional Apify Proxy groups (e.g., RESIDENTIAL).

## `apifyProxyCountry` (type: `string`):

Optional 2-letter country code for Apify Proxy (e.g., US, GB).

## Actor input object example

```json
{
  "url": "https://www.tiktok.com/@vmmystery/video/7624238786251148576",
  "format": "video",
  "quality": "best",
  "useApifyProxy": false
}
```

# Actor output Schema

## `results` (type: `string`):

Structured download results returned by the actor.

## `runSummary` (type: `string`):

Summary output stored under the OUTPUT record in the default key-value store for standard actor runs.

## `media` (type: `string`):

Key-value store keys for downloaded videos and audio files.

# 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 = {
    "url": "https://www.tiktok.com/@vmmystery/video/7624238786251148576"
};

// Run the Actor and wait for it to finish
const run = await client.actor("reinventingai/video-or-audio-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 = { "url": "https://www.tiktok.com/@vmmystery/video/7624238786251148576" }

# Run the Actor and wait for it to finish
run = client.actor("reinventingai/video-or-audio-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 '{
  "url": "https://www.tiktok.com/@vmmystery/video/7624238786251148576"
}' |
apify call reinventingai/video-or-audio-downloader --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Video or Audio Downloader",
        "description": "Download videos or extract audio from YouTube, TikTok, Instagram, X, Reddit, Vimeo, and 1000+ sites. Returns MP4/MP3 files with direct download URLs, metadata, and thumbnails. Supports cookie authentication for protected content and Standby mode for real-time API. Download videos easily and fast!",
        "version": "0.0",
        "x-build-id": "5PsKFjQ5ocGS05xIe"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/reinventingai~video-or-audio-downloader/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-reinventingai-video-or-audio-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/reinventingai~video-or-audio-downloader/runs": {
            "post": {
                "operationId": "runs-sync-reinventingai-video-or-audio-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/reinventingai~video-or-audio-downloader/run-sync": {
            "post": {
                "operationId": "run-sync-reinventingai-video-or-audio-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",
                "properties": {
                    "url": {
                        "title": "Single URL",
                        "type": "string",
                        "description": "A single video URL to download (YouTube, TikTok, Twitter/X, Instagram, etc). Note: for YouTube downloads, you will typically need both the Cookies.txt field and Apify Proxy enabled."
                    },
                    "urls": {
                        "title": "Multiple URLs",
                        "type": "array",
                        "description": "Optional list of URLs to download in sequence.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "format": {
                        "title": "Output format",
                        "enum": [
                            "video",
                            "audio"
                        ],
                        "type": "string",
                        "description": "Download as MP4 video or extract MP3 audio.",
                        "default": "video"
                    },
                    "quality": {
                        "title": "Video quality",
                        "enum": [
                            "best",
                            "1080p",
                            "720p",
                            "480p",
                            "360p"
                        ],
                        "type": "string",
                        "description": "Maximum resolution for video downloads.",
                        "default": "best"
                    },
                    "cookies": {
                        "title": "Cookies (Netscape format)",
                        "type": "string",
                        "description": "For YouTube downloads, this is typically required. Export cookies using Get cookies.txt CLEAN (Chrome: https://chromewebstore.google.com/detail/get-cookiestxt-clean/ahmnmhfbokciafffnknlekllgcnafnie | Firefox: https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/), then paste the entire file contents here."
                    },
                    "useApifyProxy": {
                        "title": "Use Apify Proxy",
                        "type": "boolean",
                        "description": "Enable Apify Proxy for downloads. For YouTube, this should typically be turned on together with the Cookies.txt field because YouTube often blocks datacenter IPs.",
                        "default": false
                    },
                    "apifyProxyGroups": {
                        "title": "Apify Proxy groups",
                        "type": "array",
                        "description": "Optional Apify Proxy groups (e.g., RESIDENTIAL).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "apifyProxyCountry": {
                        "title": "Apify Proxy country",
                        "type": "string",
                        "description": "Optional 2-letter country code for Apify Proxy (e.g., US, GB)."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
