# Youtube Downloader (`soft_alexist/youtube-downloader`) Actor

Extracts direct download URLs and core metadata from YouTube videos in bulk — useful for content archiving, offline distribution, video processing pipelines, and research workflows.

- **URL**: https://apify.com/soft\_alexist/youtube-downloader.md
- **Developed by:** [Soft Alexist](https://apify.com/soft_alexist) (community)
- **Categories:** Automation, Developer tools, Social media
- **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/platform/actors/running/actors-in-store#pay-per-usage

## 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

## YouTube Video Downloader Scraper

### Overview

Extracts direct download URLs and core metadata from YouTube videos in bulk — useful for content archiving, offline distribution, video processing pipelines, and research workflows.

***

### Input Format

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=...",
    "https://www.youtube.com/shorts/..."
  ]
}
```

- **`urls`**: Array of YouTube video URLs (`youtube.com/watch?v=...`).

***

### Output Format

| Field | Type | Description |
|---|---|---|
| `video_id` | String | Unique YouTube identifier from the URL |
| `title` | String | Full video title as shown on YouTube |
| `length_seconds` | Integer | Total duration in seconds |
| `download_urls` | Array | Direct file URLs across all available formats and qualities |

Each entry in `download_urls` includes:

| Sub-field | Description |
|---|---|
| `url` | Direct playback/download link |
| `mime_type` | File format and codec (e.g., `video/mp4`, `audio/webm`) |
| `quality_label` | Human-readable quality (e.g., `1080p`, `720p`, `480p`) |
| `width` / `height` | Resolution in pixels |
| `fps` | Frames per second |
| `bitrate` / `average_bitrate` | Bitrate in bps |
| `content_length` | File size in bytes |

#### Example Output (abbreviated)

```json
{
  "video_id": "DEofhN7oun0",
  "title": "Example Video Title",
  "length_seconds": "373",
  "download_urls": [
    {
      "url": "https://rr2---sn-....googlevideo.com/videoplayback?...",
      "mime_type": "video/mp4; codecs=\"avc1.640028\"",
      "quality_label": "1080p",
      "width": 1920,
      "height": 1080,
      "fps": 30,
      "bitrate": 4345033,
      "content_length": "119275508"
    },
    {
      "url": "https://rr2---sn-....googlevideo.com/videoplayback?...",
      "mime_type": "audio/mp4; codecs=\"mp4a.40.2\"",
      "quality_label": "",
      "width": 0,
      "height": 0,
      "fps": 0,
      "bitrate": 130855,
      "content_length": "6040133"
    }
  ]
}
```

> ⚠️ **Download URLs are time-limited.** They expire within minutes to hours. Act on them immediately after extraction.

***

### Usage

1. **Collect URLs** — Use clean `watch?v=VIDEO_ID` format when possible. Avoid playlist URLs with extra parameters.
2. **Set `ignore_url_failures: true`** — Prevents one bad URL from halting a batch job.
3. **Run and act promptly** — Initiate downloads or pass URLs to your pipeline as soon as results return.
4. **Use `video_id` as your primary key** — Stable across records; can reconstruct the source URL anytime.
5. **Use `length_seconds` for size estimation** — Helps forecast storage requirements before downloading.

***

### Common Issues

| Problem | Solution |
|---|---|
| URL returns 403/410 error | Token expired — re-run the scraper for fresh links |
| Video skipped silently | Check run log; verify video is public and accessible on YouTube |
| Wrong video returned | Use clean `watch?v=` URLs; avoid shortened or playlist URLs |

***

### Use Cases

- **Archiving**: Build offline libraries of owned or licensed video content
- **Offline education**: Distribute lecture/tutorial videos in low-connectivity environments
- **Processing pipelines**: Feed URLs into transcoding, captioning, or computer vision systems
- **Research**: Collect raw video files for academic datasets (subject to licensing and ethics review)
- **Content ops**: Automate video asset retrieval for internal editing or compliance workflows

# Actor input Schema

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

Add the URLs of the Specific video urls you want to scrape. You can paste URLs one by one, or use the Bulk edit section to add a prepared list.

## `proxy` (type: `object`):

Choose proxy settings for the scraper to use. If you don't want to use a proxy, leave the settings blank.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=qPKSEEbwO9A"
  ],
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# 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 = {
    "urls": [
        "https://www.youtube.com/watch?v=qPKSEEbwO9A"
    ],
    "proxy": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("soft_alexist/youtube-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 = {
    "urls": ["https://www.youtube.com/watch?v=qPKSEEbwO9A"],
    "proxy": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("soft_alexist/youtube-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 '{
  "urls": [
    "https://www.youtube.com/watch?v=qPKSEEbwO9A"
  ],
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}' |
apify call soft_alexist/youtube-downloader --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/Kim9WevBPzxiQyzaR/builds/0pHLbVPM8sTclc3xW/openapi.json
