# Media / CDN Extractor ($0.001 pre Request) (`mikolabs/media-cdn-url-extractor`) Actor

Extract direct CDN links for videos, images, GIFs, and all media from YouTube, Twitter, Instagram, TikTok, Reddit, Vimeo, Bilibili, and 20+ platforms. Get direct download URLs, and media metadata via batch processing.

- **URL**: https://apify.com/mikolabs/media-cdn-url-extractor.md
- **Developed by:** [mikolabs](https://apify.com/mikolabs) (community)
- **Categories:** Videos, Social media, Integrations
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.80 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Media CDN URL Extractor — Download URLs from Any Video Platform

**Extract direct CDN download links from YouTube, Twitter, Instagram, TikTok, and 20+ more platforms in seconds.**

Get video download URLs, audio extraction links, and media metadata from any public source. Process batch URLs instantly. No rate limiting, no registration walls.

### What does this Actor do?

This Actor extracts **direct CDN download links** from any media URL. Simply provide a list of video or media URLs, and it instantly returns:

- **Direct CDN URLs** for instant downloads (Twitter, Instagram, Facebook, Vimeo, etc.)
- **Download proxy URLs** for complex processing (YouTube, TikTok, Reddit, Bilibili, etc.)
- **Media metadata** (filename, duration, format, quality)
- **Batch results** as JSON, CSV, HTML, or Excel

Perfect for downloading videos, archiving content, extracting audio, or automating media pipelines.

#### Supported platforms
**Video platforms:** YouTube, TikTok, Instagram, Twitter/X, Facebook, Snapchat  
**Music platforms:** SoundCloud, YouTube Music, Spotify preview URLs  
**Stream platforms:** Twitch, Vimeo, Dailymotion, Loom, Streamable  
**Social networks:** Reddit, Tumblr, Bluesky, Pinterest, VK, OK.ru  
**International:** Bilibili, Rutube, Newgrounds, and 20+ more

### Why extract CDN links with this Actor?

#### Fast & Efficient
Get **direct download links instantly** without needing plugins, extensions, or websites that embed ads or inject malware.

#### For developers integrating media extraction
- **Batch processing:** Extract 1000+ URLs in a single run
- **Scheduled jobs:** Download new uploads daily via Apify scheduler
- **Webhook support:** Push results to Slack, email, Discord, or databases
- **Fast processing:** 3–15 seconds per URL

#### For content creators & archivists
- **Bulk downloads:** Archive entire playlists, channels, or profiles in one operation
- **Format selection:** Extract audio-only, video without audio, or best quality
- **Metadata preservation:** Keep original filenames, upload dates, creator info
- **Export flexibility:** JSON, CSV, Excel — pipe directly to storage or analytics

#### For researchers & data teams
- **Consistent data format** across all platforms
- **Historical tracking:** Monitor URL changes and availability
- **Integration:** Feed into data pipelines, ML models, or databases

### How to use this Actor

#### Step 1: Prepare your media URLs

Collect URLs from supported platforms:
- YouTube: `https://www.youtube.com/watch?v=abc123`
- Twitter: `https://twitter.com/user/status/123456`
- Instagram: `https://instagram.com/p/xyz789`

#### Step 2: Run and get CDN links

Click **Start** → Actor processes URLs → Download results as JSON/CSV/Excel with direct CDN links

### Input

#### URLs array (required)
List of media URLs to extract CDN links from. Supports 20+ platforms including YouTube, Twitter, Instagram, TikTok, Facebook, Reddit, Vimeo, Bilibili, and more.

**Example:**
```json
{
  "urls": [
    {"url": "https://www.youtube.com/watch?v=abc123"},
    {"url": "https://twitter.com/user/status/123456"}
  ]
}
````

### Output

Per-URL result with direct CDN download link:

```json
{
  "sourceUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "status": "redirect",
  "url": "https://rr5---sn-ci5gup-2o9s.googlevideo.com/videoplayback?...",
  "filename": "Rick Astley - Never Gonna Give You Up.mp4"
}
```

**Output fields:**

- `sourceUrl` — Original media URL you provided
- `url` — **Direct CDN download link** (ready to download/stream)
- `filename` — Suggested filename for the media
- `status` — `redirect` (success) or `error` (if extraction failed)

### CDN Link Validity

All extracted links are **direct CDN download URLs** valid for hours. You can:

- Download immediately
- Share the link (it works for others)
- Embed in players or apps
- Stream without extra processing

**Tips to reduce cost:**

- Batch similar platforms (YouTube slower than Twitter)
- Remove duplicates before running
- Schedule off-peak for discounted compute units

### Advanced options

#### Batch best practices

- **Group by platform:** YouTube batches: 10–15s/URL. Twitter batches: 3–5s/URL
- **Error handling:** Failed URLs appear in results with error codes
- **Rate limiting:** Actor respects platform limits; wait before rerunning

#### Local testing

```bash
apify login
apify run
```

Local runs behave identically to cloud runs.

### FAQ

#### Is it legal to extract CDN links from YouTube, Twitter, etc.?

Yes — extracting URLs is legal. **But using them is your responsibility:**

✅ **Legal:** Download your own content, content with explicit permission, public domain, Creative Commons\
⚠️ **Risky:** Copyright-protected content, DMCA takedown risk, platform ToS violation\
❌ **Illegal:** Distributing pirated content, circumventing DRM, commercial resale of protected material

**Always check platform ToS and respect copyright.** This Actor is a tool — use it responsibly.

#### Why did my URLs fail?

| Error | Reason | Solution |
|-------|--------|----------|
| `not_found` | Video deleted or private | Use a public/shareable link |
| `unsupported` | Platform not in our list | Request feature in Issues |
| `rate_limited` | Too many requests | Wait 1-5 minutes, then retry |
| `auth_required` | Content requires login | Make sure you have access |
| `timeout` | Server slow or overloaded | Retry in 30 seconds |

#### How fast is this?

**This Actor:** 3–15 seconds per URL\
**Manual copy-paste:** Hours or days (for playlists/channels)

#### Can I download an entire YouTube channel?

Not directly — you need a list of video URLs first. Options:

1. Use YouTube Playlist Extractor to get video URLs
2. Feed those URLs to this Actor
3. Download all videos in parallel

Or contact us for a custom solution.

#### How do I integrate this into my app?

Use the **Apify API** for batch jobs:

```bash
curl -X POST https://api.apify.com/v2/actor-runs \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{"actorId":"rishikesh/media-cdn-url-extractor"}'
```

See [Apify docs](https://docs.apify.com/) for full integration examples.

#### Support & feedback

- **Bug reports or feature requests:** [GitHub Issues](https://github.com/apify/actors/issues)
- **Questions?** Open an issue or contact Apify support
- **Docs:** [Apify Actor documentation](https://docs.apify.com/)

# Actor input Schema

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

List of media URLs to extract CDN links from. Supports YouTube, Twitter, Instagram, TikTok, Vimeo, Facebook, Reddit, Bilibili, and 15+ other platforms.

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    },
    {
      "url": "https://x.com/NVIDIAGeForce/status/2055317333208367197"
    },
    {
      "url": "https://x.com/NVIDIAGeForce/status/2055317333208367197"
    }
  ]
}
```

# Actor output Schema

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

Contains extracted CDN URLs, tunnel URLs, and metadata for each processed media URL

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

// Run the Actor and wait for it to finish
const run = await client.actor("mikolabs/media-cdn-url-extractor").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": [
        { "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" },
        { "url": "https://x.com/NVIDIAGeForce/status/2055317333208367197" },
        { "url": "https://x.com/NVIDIAGeForce/status/2055317333208367197" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("mikolabs/media-cdn-url-extractor").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": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    },
    {
      "url": "https://x.com/NVIDIAGeForce/status/2055317333208367197"
    },
    {
      "url": "https://x.com/NVIDIAGeForce/status/2055317333208367197"
    }
  ]
}' |
apify call mikolabs/media-cdn-url-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=mikolabs/media-cdn-url-extractor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Media / CDN Extractor ($0.001 pre Request)",
        "description": "Extract direct CDN links for videos, images, GIFs, and all media from YouTube, Twitter, Instagram, TikTok, Reddit, Vimeo, Bilibili, and 20+ platforms. Get direct download URLs, and media metadata via batch processing.",
        "version": "1.0",
        "x-build-id": "db3o2kb3pSYjjVv2W"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/mikolabs~media-cdn-url-extractor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-mikolabs-media-cdn-url-extractor",
                "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/mikolabs~media-cdn-url-extractor/runs": {
            "post": {
                "operationId": "runs-sync-mikolabs-media-cdn-url-extractor",
                "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/mikolabs~media-cdn-url-extractor/run-sync": {
            "post": {
                "operationId": "run-sync-mikolabs-media-cdn-url-extractor",
                "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",
                "required": [
                    "urls"
                ],
                "properties": {
                    "urls": {
                        "title": "Media URLs",
                        "type": "array",
                        "description": "List of media URLs to extract CDN links from. Supports YouTube, Twitter, Instagram, TikTok, Vimeo, Facebook, Reddit, Bilibili, and 15+ other platforms.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
