# YouTube Audio Downloader (`deepmine/youtube-audio-downloader`) Actor

YouTube Audio Downloader saves videos, Shorts and playlists as M4A audio with a download link for every file. Billed by the second with a 60-second minimum per file. A 4-minute song costs $0.018. Failed videos are free.

- **URL**: https://apify.com/deepmine/youtube-audio-downloader.md
- **Developed by:** [DeepMine](https://apify.com/deepmine) (community)
- **Categories:** Videos, Social media, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.08 / 1,000 audio seconds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

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

**YouTube Audio Downloader** saves the sound of YouTube videos, Shorts and playlists as **M4A audio files**. Paste
the links and click Start: every file is saved with a download link, the title, channel and duration. You pay
$0.0045 a minute of audio, billed by the second with a 60-second minimum per file. **A 4-minute song costs $0.018**.

No account, no cookies and no browser extension: you only need the links.

### What you get

- **M4A audio (AAC)**, the format YouTube itself streams, so nothing is re-encoded and nothing is lost. It plays on
  every phone, computer, car stereo and editor that plays MP3.
- **Videos, Shorts and playlists.** A playlist link adds its videos (up to 100 from one playlist). A channel’s Shorts tab adds its newest Shorts, up to `maxVideos`.
- **One row per file** with a direct download link, ready for a spreadsheet, a script or an automation.
- **Made-for-kids videos** (nursery rhymes, cartoons) download too.

### How to use it

1. Paste one or more YouTube links (or bare video ids) into **YouTube URLs**.
2. Click **Start**.
3. When the run ends, open the **Output** tab and click a file link to download it.

### Input example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://www.youtube.com/playlist?list=PLxxxxxxxxxxxxxxxx"
  ],
  "format": "audio_m4a",
  "maxVideos": 20
}
```

| Field | What it does |
| --- | --- |
| `urls` | Video, Short, playlist or channel Shorts tab links, or bare video IDs. |
| `format` | `audio_m4a` (M4A audio, AAC). |
| `maxVideos` | Stop after this many files in all, playlists included (default 100). |

### Output example

One row looks like this:

```json
{
  "videoId": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "channelName": "Rick Astley",
  "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "durationSeconds": 213,
  "duration": "3:33",
  "format": "audio_m4a",
  "quality": "audio",
  "container": "m4a",
  "fileSizeMb": 3.45,
  "fileUrl": "https://api.apify.com/v2/key-value-stores/<store id>/records/dQw4w9WgXcQ-audio-m4a.m4a",
  "fileKey": "dQw4w9WgXcQ-audio-m4a.m4a",
  "fileStorage": "Run key-value store",
  "chargedSeconds": 213
}
```

Open the `fileUrl` in each dataset row to download your file. Files stay in the run’s key-value store
for your plan’s retention period.
The `fileStorage` column tells you where they were saved. The run summary lists files saved and failed and seconds charged.

### Pricing

You pay **$0.0045 a minute** of each saved audio file, billed by the second ($0.075 per 1,000 seconds). Every
file counts at least one minute; past that, you pay for each second, not for each started minute.

| What you save | Length | Price |
| --- | --- | --- |
| A song | 3:33 | $0.016 |
| A podcast episode | 1 hour | $0.27 |
| 20 songs of 3:30 | 70 minutes | $0.32 |
| A Short | 0:12 (counts 1 minute) | $0.0045 |

Missing, private, removed and failed videos are never charged, and the dataset rows are free. The run checks your
spending limit before each file, so it never goes over it.

### Good to know

- **A video isn't found:** links to private, removed or non-existent videos get the line "Video not found or
  unavailable" in the summary and cost nothing.
- **Nothing could be downloaded:** YouTube sometimes refuses every proxy IP a run has, most often on plans with only
  a few shared proxy IPs. The run then saves nothing, charges nothing and says so; try again later.
- **MP3:** files come as M4A, which every player that plays MP3 also plays. MP3 itself is not offered yet.
- **Video:** to save the picture too, use our YouTube Video Downloader.

### FAQ

**Do I need a YouTube account or cookies?** No. Paste public links and run.

**Can I save a whole playlist as audio?** Yes, paste the playlist link. Set `maxVideos` to cap how many it takes.

**Can I use it from my own code?** Yes. Start runs through the Apify API or one of the Apify client libraries, then
read the dataset rows and download each `fileUrl`.

# Actor input Schema

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

Video, Short, playlist or channel Shorts tab links (or bare video IDs). Each video produces one M4A audio file.

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

M4A (AAC audio): plays on every phone, computer, car and editor that plays MP3.

## `maxVideos` (type: `integer`):

Stop after this many files in all. A playlist link adds its videos up to this number.

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

Apify datacenter proxy is the default and the cheapest.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "format": "audio_m4a",
  "maxVideos": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

No description

## `summary` (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 = {
    "urls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("deepmine/youtube-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 = { "urls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"] }

# Run the Actor and wait for it to finish
run = client.actor("deepmine/youtube-audio-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 '{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ]
}' |
apify call deepmine/youtube-audio-downloader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,deepmine/youtube-audio-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/8oQIIuRxvVOisMEgF/builds/FAq9Y2d4Hp6MZGtsG/openapi.json
