# YouTube Shorts Downloader (Fast & Lightweight) (`fire_dev/youtube-shorts-downloader`) Actor

Ultra-fast, credit-optimized YouTube Shorts downloader using yt-dlp. Runs on minimal 256MB memory, strictly validates shorts, and outputs direct MP4 downloads to Key-Value Store.

- **URL**: https://apify.com/fire_dev/youtube-shorts-downloader.md
- **Developed by:** [Fire Dev](https://apify.com/fire_dev) (community)
- **Stats:** 2 total users, 1 monthly users, 80.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

<div align="center">

## ⚡ YouTube Shorts Downloader

**Ultra-fast, credit-optimized YouTube Shorts media & metadata downloader powered by yt-dlp on the Apify platform.**

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-blue?logo=apify\&style=for-the-badge)](https://apify.com/fire_dev/youtube-shorts-downloader)
[![Docker](https://img.shields.io/badge/Docker-Python%203.13-3776AB?logo=python\&style=for-the-badge)](https://hub.docker.com/r/apify/actor-python)
[![Memory](https://img.shields.io/badge/Memory-256MB%20Ultra--Light-success?style=for-the-badge)](#credit--resource-optimization)
[![yt--dlp](https://img.shields.io/badge/Engine-yt--dlp-red?logo=youtube\&style=for-the-badge)](https://github.com/yt-dlp/yt-dlp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](LICENSE)

<p align="center">
  <a href="#key-features">Key Features</a> •
  <a href="#how-it-works">How It Works</a> •
  <a href="#credit--resource-optimization">Credit Optimization</a> •
  <a href="#input-configuration">Input Configuration</a> •
  <a href="#output-data">Output Data</a> •
  <a href="#local-testing">Local Testing</a>
</p>

</div>

***

> \[!IMPORTANT]
> **Shorts-Only Enforcement**: This Actor is engineered specifically for **YouTube Shorts** ($\le 180$ seconds, vertical format). Non-Shorts and standard full-length videos ($> 180$s or horizontal 16:9 videos) are automatically rejected prior to downloading to safeguard your Apify compute credits.

***

### 🚀 Key Features

- **⚡ Ultra-Low Resource Usage**: Runs on just **256 MB of RAM** without headless browsers, consuming minimal compute credits per run.
- **🎯 Pure Shorts Focus**: Pre-inspects video length and aspect ratio, skipping non-shorts before data transfer starts.
- **📦 Direct MP4 Downloads**: Automatically saves videos to Apify's Key-Value Store (`SHORT_<id>.mp4`) with permanent direct download URLs.
- **📊 Comprehensive Metadata**: Extracts channel data, view count, like count, comment count, duration, upload date, and thumbnail links into the default Dataset.
- **🔄 Lossless Stream Remuxing**: Leverages fast `ffmpeg` stream remuxing (`-c copy`) without re-encoding, processing short-form videos in 2–5 seconds.
- **🛡️ Apify Proxy Ready**: Integrated proxy support for handling restricted or rate-limited regions.

***

### 🏗️ Architecture & Execution Flow

```mermaid
flowchart TD
    A["User Input (Shorts URLs)"] --> B["URL Normalization & Validation"]
    B --> C{"Pre-Download Check"}
    C -->|"Duration > 180s or Landscape"| D["Skip Video & Log Reason"]
    D --> E["Push Skipped Status to Dataset"]
    C -->|"Valid Short (<=180s)"| F["Fast Stream Download (yt-dlp)"]
    F --> G["Stream Copy Remuxing (ffmpeg)"]
    G --> H["Save .mp4 to Key-Value Store"]
    H --> I["Push Metadata & Direct URL to Dataset"]
    I --> J["Cleanup Temporary Media"]
```

***

### 💰 Credit & Resource Optimization

Compute units on Apify are billed by $\text{Memory (GB)} \times \text{Duration (hours)}$. Most scrapers spin up resource-heavy headless browsers (Chromium/Playwright) demanding 1 GB to 4 GB of RAM.

| Runner Setup | Memory Allocated | Relative Compute Units Cost | Average Speed / Short |
| :--- | :---: | :---: | :---: |
| **YouTube Shorts Downloader (This Actor)** | **256 MB** | **1x (Lowest Possible)** | **~3 seconds** |
| Standard Puppeteer Scraper | 1024 MB | 4x | ~12 seconds |
| Playwright Full Browser Actor | 2048 MB | 8x | ~18 seconds |
| Heavy Multi-Tab Scraper | 4096 MB | 16x | ~30 seconds |

> \[!TIP]
> Because this Actor operates with direct HTTP stream retrieval and zero video re-encoding, you can download hundreds of Shorts for mere cents in platform credits.

***

### ⚙️ Input Configuration

| Parameter | Type | Default | Description |
| :--- | :---: | :---: | :--- |
| `shortsUrls` | `array` | `[]` | List of YouTube Shorts URLs (`https://www.youtube.com/shorts/...`). |
| `quality` | `string` | `"best"` | Target video resolution: `best`, `1080p`, `720p`, `480p`, or `audio_only`. |
| `saveVideoToKeyValueStore` | `boolean` | `true` | When true, uploads the MP4 directly into Apify's Key-Value Store. |
| `includeMetadata` | `boolean` | `true` | Includes full metadata (views, likes, author, duration) in Dataset. |
| `proxyConfiguration` | `object` | `{ "useApifyProxy": false }` | Optional Apify Proxy configuration. |

#### Sample JSON Input

```json
{
  "shortsUrls": [
    "https://www.youtube.com/shorts/dQw4w9WgXcQ",
    "https://www.youtube.com/shorts/k9nKjQzHh6Q"
  ],
  "quality": "best",
  "saveVideoToKeyValueStore": true,
  "includeMetadata": true
}
```

***

### 📤 Output Data

Every processed video produces a record in the default Dataset:

```json
{
  "id": "dQw4w9WgXcQ",
  "url": "https://www.youtube.com/shorts/dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up",
  "duration": 58,
  "uploader": "Rick Astley",
  "uploaderId": "@RickAstleyYT",
  "uploaderUrl": "https://www.youtube.com/@RickAstleyYT",
  "viewCount": 24500000,
  "likeCount": 1820000,
  "commentCount": 42000,
  "thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
  "uploadDate": "20231015",
  "downloadUrl": "https://api.apify.com/v2/key-value-stores/<STORE_ID>/records/SHORT_dQw4w9WgXcQ.mp4",
  "fileSizeMb": 8.42,
  "status": "SUCCESS"
}
```

***

### 🛠️ Local Development & CLI

```bash
## Clone or navigate to the directory
cd /root/youtube-shorts-downloader

## Validate Actor schemas
apify validate-schema

## Run Actor in cloud
apify call fire_dev/youtube-shorts-downloader -i '{"shortsUrls":["https://www.youtube.com/shorts/VIDEO_ID"]}'
```

***

<div align="center">
  <sub>Maintained by <a href="https://github.com/Fire162">Fire162</a>. Built with ❤️ for minimal resource consumption.</sub>
</div>

# Actor input Schema

## `shortsUrls` (type: `array`):

List of YouTube Shorts URLs (e.g., https://www.youtube.com/shorts/VIDEO_ID or https://youtu.be/VIDEO_ID). Note: Standard long videos (>180s) are automatically rejected to preserve credits.

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

Target video resolution. Directly remuxes streams without re-encoding to minimize CPU and runtime.

## `saveVideoToKeyValueStore` (type: `boolean`):

Stores the resulting MP4 in the Actor's default Key-Value Store so you can download the video file via a direct link.

## `includeMetadata` (type: `boolean`):

Records comprehensive metadata (title, author, view count, like count, duration, direct link) in the dataset.

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

Optional Netscape format cookies. Export with 'Get cookies.txt LOCALLY' extension to bypass YouTube cloud bot detection or access age-restricted Shorts.

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

Optional proxy settings for regions where YouTube restricts direct connection.

## Actor input object example

```json
{
  "shortsUrls": [
    "https://www.youtube.com/shorts/JfbnpYLe3Ms"
  ],
  "quality": "best",
  "saveVideoToKeyValueStore": true,
  "includeMetadata": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (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 = {
    "shortsUrls": [
        "https://www.youtube.com/shorts/JfbnpYLe3Ms"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("fire_dev/youtube-shorts-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 = { "shortsUrls": ["https://www.youtube.com/shorts/JfbnpYLe3Ms"] }

# Run the Actor and wait for it to finish
run = client.actor("fire_dev/youtube-shorts-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 '{
  "shortsUrls": [
    "https://www.youtube.com/shorts/JfbnpYLe3Ms"
  ]
}' |
apify call fire_dev/youtube-shorts-downloader --silent --output-dataset

```

## MCP server setup

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