# YouTube to MP3 Audio Downloader (`lurkapi/youtube-to-mp3-audio-downloader`) Actor

Download YouTube audio as MP3, AAC (M4A), or WAV. Paste one or more links, pick format and bitrate, get permanent download links. Supports playlists, Shorts, and batch processing.

- **URL**: https://apify.com/lurkapi/youtube-to-mp3-audio-downloader.md
- **Developed by:** [LurkAPI](https://apify.com/lurkapi) (community)
- **Categories:** Automation, Social media, Videos
- **Security:** Limited permissions
- **Stats:** 726 total users, 126 monthly users, 100.0% runs succeeded, 7 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $2.00 / 1,000 minute downloadeds

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/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 to MP3 Audio Downloader

Download audio from any YouTube video as MP3, M4A, FLAC, WAV, AAC, OPUS, Vorbis, or ALAC. Paste one or more links, pick your format and quality, get permanent download links. Optionally embed metadata and album art directly into the audio file.

### 🎵 What it does

Give it one or more YouTube links, and it will:

1. **Extract the audio** from each video in your chosen format and bitrate
2. **Save the audio files** to your Apify storage with permanent download links
3. **Grab video details** like the channel name, title, duration, view count, and more
4. **Save the thumbnails** with permanent links

Works with any public YouTube video, Shorts, and playlists. Just copy the link from the YouTube app or website.

### 🔗 Real file downloads, not redirect links

Unlike most YouTube audio tools that only give you temporary Google CDN links (which expire within hours and get blocked when fetched from a backend server), this Actor **fully downloads the audio file** and stores it in your Apify storage. You get a permanent URL that:

- Works from any server, any IP, any time
- Never expires (retention depends on your Apify plan)
- Is safe for backend integrations, automation pipelines, and programmatic access
- Can be shared directly as a download link

### 📥 How to use it

#### Step 1: Paste your links and choose options

Add your YouTube URLs and select format/quality in the input.

```json
{
    "videoUrls": [
        "https://www.youtube.com/watch?v=9bZkp7q19f0",
        "https://youtu.be/kJQP7kiw5Fk"
    ],
    "audioFormat": "mp3",
    "audioBitrate": "192k",
    "embedMetadata": true,
    "maxVideosPerUrl": 25
}
```

**Format options:**

- **MP3**: Most compatible format, works everywhere
- **M4A (AAC)**: Better quality than MP3 at the same bitrate, great for Apple devices
- **WAV**: Uncompressed lossless audio, large files, best for editing and production
- **FLAC**: Compressed lossless audio, smaller than WAV with no quality loss
- **AAC**: Raw AAC stream (without M4A container)
- **OPUS**: Modern efficient codec, great quality at low bitrates
- **Vorbis**: Open-source compressed format (OGG container)
- **ALAC**: Apple's lossless format, ideal for iTunes and Apple devices

**Quality options:** auto (best available), 320k (highest), 256k, 192k (default), 128k, 64k (smallest). Lossless formats (WAV, FLAC, ALAC) ignore this setting.

**Metadata embedding:** Set `embedMetadata` to `true` to embed the video title, artist, and thumbnail as album art directly into the audio file. Works with all formats except WAV. Adds about 100-500 KB to file size depending on the thumbnail.

**Playlist size:** `maxVideosPerUrl` controls how many videos are read from each playlist, Mix, or radio queue. Downloads begin as soon as the first entries are discovered, while the remaining entries continue loading in the background. The accepted range is 1–5,000.

**Supported URL types:**

- Full links: `youtube.com/watch?v=...`
- Short links: `youtu.be/...`
- Shorts: `youtube.com/shorts/...`
- Playlists: `youtube.com/playlist?list=...` (auto-expanded into individual videos)
- YouTube Music: `music.youtube.com/watch?v=...`

#### Step 2: Run it

Click **Start** and wait for it to finish. Audio extraction is fast: most songs finish in under 30 seconds.

#### Step 3: Get your files

Once it's done, check the **Output** tab. Each result includes:

- **status**: "Success" or a message explaining what went wrong and what to do about it
- **audioFileUrl**: Permanent link to the audio file in your Apify storage
- **thumbnailFileUrl**: Permanent link to the thumbnail image
- **title**, **channel**, **duration**, **uploadDate**: Video metadata
- **audioFormat**, **audioBitrate**: The format and quality used
- **fileSize**: File size in bytes
- **stats**: Views, likes, and comments

#### Example output

```json
{
    "status": "Success",
    "videoId": "dQw4w9WgXcQ",
    "title": "Rick Astley - Never Gonna Give You Up (Official Music Video)",
    "channel": "Rick Astley",
    "duration": 212,
    "uploadDate": "2009-10-25",
    "audioFileUrl": "https://api.apify.com/v2/key-value-stores/.../records/audio-dQw4w9WgXcQ",
    "thumbnailFileUrl": "https://api.apify.com/v2/key-value-stores/.../records/thumbnail-dQw4w9WgXcQ",
    "audioFormat": "mp3",
    "audioBitrate": "192k",
    "fileSize": 3407872
}
```

### 🌐 Proxy settings

By default, the Actor uses Apify's datacenter proxies.

- **Automatic (default)**: Apify selects the best proxy.
- **Datacenter**: Fast and cheap. Works for popular videos, but YouTube may block some requests.
- **Residential**: Available as an advanced override. The default mode already performs a bounded automatic recovery attempt when cheaper routes fail.
- **Own proxies**: Provide your own proxy URLs.
- **No proxy**: Disable proxies. Not recommended for YouTube.

### 💰 Pricing

This Actor charges per minute of audio downloaded. You only pay for successful downloads. Failed extractions are free. If you enable metadata embedding, a small additional charge applies per file.

Prices are shown on the Actor's pricing card above.

**Example:** A 3.5-minute song counts as 4 minutes (rounded up).

### 💡 Good to know

- **Connection recovery is automatic:** The Actor rotates blocked sessions and can use one bounded higher-reliability fallback without requiring input changes.
- **Age-restricted videos** cannot be downloaded. They require a logged-in YouTube account, which this Actor does not have.
- **Private videos** cannot be downloaded. You'll get a clear error message.
- **Playlists** are automatically expanded into individual videos.
- **Shorts** work just like regular videos.
- Short links (`youtu.be/...`) are resolved automatically.
- Duplicate URLs are automatically removed.
- Each playlist, Mix, or radio queue can include up to 5,000 videos, and downloads begin as entries are discovered.
- WAV and FLAC files are large (WAV: ~10 MB/min, FLAC: ~5 MB/min). For most uses, MP3 or M4A is recommended.
- Audio files are stored in your Apify storage. How long they're kept depends on your Apify plan.

### ❓ FAQ

**Why did my download fail?**
The most common reason is YouTube blocking every available recovery route. Retry later; the Actor handles route changes automatically. If the video is age-restricted or private, it cannot be downloaded.

**Which format should I choose?**

- **MP3** for maximum compatibility (works on every device and player)
- **M4A** for better quality at the same file size (ideal for Apple devices)
- **FLAC** for lossless audio in a compressed container (smaller than WAV, no quality loss)
- **WAV** for uncompressed lossless audio (ideal for editing, production, or sampling)
- **OPUS** for the best quality-to-size ratio (ideal for voice, podcasts, or storage-limited use cases)
- **ALAC** for lossless audio on Apple devices (iTunes, iPhone, iPad)

**Which bitrate should I choose?**
192k is a good default for most uses. Choose 320k for the highest quality. Choose 128k for smaller files. Choose 64k for voice recordings or podcasts where size matters most. Choose "auto" to let the tool pick the best available quality automatically. Lossless formats (WAV, FLAC, ALAC) ignore this setting entirely.

**What does "Embed Metadata" do?**
When enabled, the tool writes the video title, artist name, and thumbnail image directly into the audio file as ID3 tags and album art. This means your music player will show the song name and cover art without needing an internet connection. Works with all formats except WAV.

**How long are the files stored?**
Audio files are stored in your Apify storage. How long they're kept depends on your Apify plan. Check your plan details for retention periods.

**Can I download private videos?**
No. Private videos require a logged-in YouTube account, which this Actor does not have. You'll see a clear error message in the output.

**Is there a file size limit?**
Audio files are capped at 500 MB. MP3 and M4A files are small (about 1 MB per minute at 128k). Lossless files are larger: WAV is about 10 MB per minute, FLAC is about 5 MB per minute. For very long recordings, use MP3 or M4A instead of lossless formats.

**Can I use this from my backend?**
Yes. The `audioFileUrl` is a permanent URL stored on Apify's servers. Unlike Google CDN links, it works from any IP and any server. This is specifically designed for backend integrations and automation. Call the Actor via the [Apify API](https://docs.apify.com/api/v2) and read the dataset items to get the download URLs.

### ⚖️ Disclaimer

This tool is intended for personal, research, and educational use. You are responsible for complying with YouTube's Terms of Service and applicable laws in your jurisdiction. The developer is not liable for misuse. Data availability depends on YouTube at run time.

**Keywords:** youtube to mp3, youtube audio downloader, youtube mp3 converter, youtube audio extractor, download youtube audio, youtube m4a, youtube music downloader

# Actor input Schema

## `videoUrls` (type: `array`):

Paste your YouTube links here. Supports video URLs, short links (youtu.be/...), Shorts, and playlist URLs.

## `audioFormat` (type: `string`):

Select the audio output format. MP3 is the most compatible. M4A (AAC) has better quality at the same bitrate. FLAC and WAV are lossless. OPUS and Vorbis are efficient compressed formats. ALAC is Apple's lossless format.

## `audioBitrate` (type: `string`):

Audio bitrate. 'source' keeps the original YouTube audio with no re-encode (best quality, m4a or webm container — fastest too). 'auto' lets the tool pick a sensible default. Specific bitrates (e.g. 320k) transcode; output will never exceed source bitrate so asking for 320k on a 130k source yields ~130k. Lossless formats (WAV/FLAC/ALAC) ignore this setting.

## `maxVideosPerUrl` (type: `integer`):

When a URL is a playlist, Mix, or radio queue, expand at most this many videos from it. Use this to cap how many downloads a single playlist URL can trigger. Regular single-video URLs are not affected. Range 1–5000.

## `embedMetadata` (type: `boolean`):

Embed title, artist, and album art (thumbnail) directly into the audio file. Increases file size by 100-500 KB depending on the thumbnail. Works with MP3, M4A, AAC, FLAC, OPUS, Vorbis, and ALAC. WAV does not support embedded artwork.

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

Connection routing is handled automatically. Advanced users may override the default here.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=9bZkp7q19f0"
  ],
  "audioFormat": "mp3",
  "audioBitrate": "auto",
  "maxVideosPerUrl": 2000,
  "embedMetadata": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": []
  }
}
```

# Actor output Schema

## `overview` (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 = {
    "videoUrls": [
        "https://www.youtube.com/watch?v=9bZkp7q19f0"
    ],
    "audioFormat": "mp3",
    "audioBitrate": "auto",
    "maxVideosPerUrl": 2000,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": []
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("lurkapi/youtube-to-mp3-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 = {
    "videoUrls": ["https://www.youtube.com/watch?v=9bZkp7q19f0"],
    "audioFormat": "mp3",
    "audioBitrate": "auto",
    "maxVideosPerUrl": 2000,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": [],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("lurkapi/youtube-to-mp3-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 '{
  "videoUrls": [
    "https://www.youtube.com/watch?v=9bZkp7q19f0"
  ],
  "audioFormat": "mp3",
  "audioBitrate": "auto",
  "maxVideosPerUrl": 2000,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": []
  }
}' |
apify call lurkapi/youtube-to-mp3-audio-downloader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lurkapi/youtube-to-mp3-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/mQWPUrN87CeP7IBaR/builds/GQhQgqfqF3WTg41Zi/openapi.json
