# Youtube to MP3 Downloader (`web.harvester/youtube-downloader`) Actor

Convert and download YouTube videos to high-quality MP3 audio files effortlessly with this actor

- **URL**: https://apify.com/web.harvester/youtube-downloader.md
- **Developed by:** [Web Harvester](https://apify.com/web.harvester) (community)
- **Categories:** Videos, Automation, Other
- **Features:** Full permissions
- **Stats:** 1,191 total users, 14 monthly users, 99.9% runs succeeded, 25 bookmarks
- **User rating**: 3.00 out of 5 stars

## Pricing

from $28.00 / 1,000 mp3 files

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

A powerful tool that allows you to download YouTube videos as MP3 files.

**Note:** The download speed depends on the size of the audio file and the speed of the proxy.

### Input

```json
{
    "includeInfo": true,
    "maxRequestRetries": 25,
    "proxyConfiguration": {
      "useApifyProxy": true
    },
    "youtubeUrls": [
      {
        "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
      },
    ]
  }
```

### Output

Example of article data in JSON format:

```json
{
	"fileUrl": "https://api.apify.com/v2/key-value-stores/e38d6424-d0f1-4a28-bf20-75f25ac1d370/records/dqw4w9wgxcq",
	"information": {
		"embed": {
			"iframeUrl": "https://www.youtube.com/embed/dQw4w9WgXcQ",
			"width": 1280,
			"height": 720
		},
		"title": "Rick Astley - Never Gonna Give You Up (Official Music Video)",
		"description": "The official video for “Never Gonna Give You Up” by Rick Astley\n\n‘Hold Me In Your Arms’ – deluxe blue vinyl,  2CD and digital deluxe out 12th May 2023 Pre-order here – https://rick-astley.lnk.to/HMIYA2023ID\n\n“Never Gonna Give You Up” was a global smash on its release in July 1987, topping the charts in 25 countries including Rick’s native UK and the US Billboard Hot 100.  It also won the Brit Award for Best single in 1988. Stock Aitken and Waterman wrote and produced the track which was the lead-off single and lead track from Rick’s debut LP “Whenever You Need Somebody”.  The album was itself a UK number one and would go on to sell over 15 million copies worldwide.\n\nThe legendary video was directed by Simon West – who later went on to make Hollywood blockbusters such as Con Air, Lara Croft – Tomb Raider and The Expendables 2.  The video passed the 1bn YouTube views milestone on 28 July 2021.\n\nSubscribe to the official Rick Astley YouTube channel: https://RickAstley.lnk.to/YTSubID\n\nFollow Rick Astley:\nFacebook: https://RickAstley.lnk.to/FBFollowID \nTwitter: https://RickAstley.lnk.to/TwitterID \nInstagram: https://RickAstley.lnk.to/InstagramID \nWebsite: https://RickAstley.lnk.to/storeID \nTikTok: https://RickAstley.lnk.to/TikTokID\n\nListen to Rick Astley:\nSpotify: https://RickAstley.lnk.to/SpotifyID \nApple Music: https://RickAstley.lnk.to/AppleMusicID \nAmazon Music: https://RickAstley.lnk.to/AmazonMusicID \nDeezer: https://RickAstley.lnk.to/DeezerID \n\nLyrics:\nWe’re no strangers to love\nYou know the rules and so do I\nA full commitment’s what I’m thinking of\nYou wouldn’t get this from any other guy\n\nI just wanna tell you how I’m feeling\nGotta make you understand\n\nNever gonna give you up\nNever gonna let you down\nNever gonna run around and desert you\nNever gonna make you cry\nNever gonna say goodbye\nNever gonna tell a lie and hurt you\n\nWe’ve known each other for so long\nYour heart’s been aching but you’re too shy to say it\nInside we both know what’s been going on\nWe know the game and we’re gonna play it\n\nAnd if you ask me how I’m feeling\nDon’t tell me you’re too blind to see\n\nNever gonna give you up\nNever gonna let you down\nNever gonna run around and desert you\nNever gonna make you cry\nNever gonna say goodbye\nNever gonna tell a lie and hurt you\n\n#RickAstley #NeverGonnaGiveYouUp #WheneverYouNeedSomebody #OfficialMusicVideo",
		"lengthSeconds": "213",
		"ownerProfileUrl": "http://www.youtube.com/@RickAstleyYT",
		"externalChannelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
		"isFamilySafe": true,
		"availableCountries": [
			"AD",
			"AE",
			"AF",
			"AG",
			"AI",
			"AL",
			"AM",
			"AO",
			"AQ",
			"AR",
			"AS",
			"AT",
			"AU",
			"AW",
			"AX",
			"AZ",
			"BA",
			"BB",
			"BD",
			"BE",
			"BF",
			"BG",
			"BH",
			"BI",
			"BJ",
			"BL",
			"BM",
			"BN",
			"BO",
			"BQ",
			"BR",
			"BS",
			"BT",
			"BV",
			"BW",
			"BY",
			"BZ",
			"CA",
			"CC",
			"CD",
			"CF",
			"CG",
			"CH",
			"CI",
			"CK",
			"CL",
			"CM",
			"CN",
			"CO",
			"CR",
			"CU",
			"CV",
			"CW",
			"CX",
			"CY",
			"CZ",
			"DE",
			"DJ",
			"DK",
			"DM",
			"DO",
			"DZ",
			"EC",
			"EE",
			"EG",
			"EH",
			"ER",
			"ES",
			"ET",
			"FI",
			"FJ",
			"FK",
			"FM",
			"FO",
			"FR",
			"GA",
			"GB",
			"GD",
			"GE",
			"GF",
			"GG",
			"GH",
			"GI",
			"GL",
			"GM",
			"GN",
			"GP",
			"GQ",
			"GR",
			"GS",
			"GT",
			"GU",
			"GW",
			"GY",
			"HK",
			"HM",
			"HN",
			"HR",
			"HT",
			"HU",
			"ID",
			"IE",
			"IL",
			"IM",
			"IN",
			"IO",
			"IQ",
			"IR",
			"IS",
			"IT",
			"JE",
			"JM",
			"JO",
			"JP",
			"KE",
			"KG",
			"KH",
			"KI",
			"KM",
			"KN",
			"KP",
			"KR",
			"KW",
			"KY",
			"KZ",
			"LA",
			"LB",
			"LC",
			"LI",
			"LK",
			"LR",
			"LS",
			"LT",
			"LU",
			"LV",
			"LY",
			"MA",
			"MC",
			"MD",
			"ME",
			"MF",
			"MG",
			"MH",
			"MK",
			"ML",
			"MM",
			"MN",
			"MO",
			"MP",
			"MQ",
			"MR",
			"MS",
			"MT",
			"MU",
			"MV",
			"MW",
			"MX",
			"MY",
			"MZ",
			"NA",
			"NC",
			"NE",
			"NF",
			"NG",
			"NI",
			"NL",
			"NO",
			"NP",
			"NR",
			"NU",
			"NZ",
			"OM",
			"PA",
			"PE",
			"PF",
			"PG",
			"PH",
			"PK",
			"PL",
			"PM",
			"PN",
			"PR",
			"PS",
			"PT",
			"PW",
			"PY",
			"QA",
			"RE",
			"RO",
			"RS",
			"RU",
			"RW",
			"SA",
			"SB",
			"SC",
			"SD",
			"SE",
			"SG",
			"SH",
			"SI",
			"SJ",
			"SK",
			"SL",
			"SM",
			"SN",
			"SO",
			"SR",
			"SS",
			"ST",
			"SV",
			"SX",
			"SY",
			"SZ",
			"TC",
			"TD",
			"TF",
			"TG",
			"TH",
			"TJ",
			"TK",
			"TL",
			"TM",
			"TN",
			"TO",
			"TR",
			"TT",
			"TV",
			"TW",
			"TZ",
			"UA",
			"UG",
			"UM",
			"US",
			"UY",
			"UZ",
			"VA",
			"VC",
			"VE",
			"VG",
			"VI",
			"VN",
			"VU",
			"WF",
			"WS",
			"YE",
			"YT",
			"ZA",
			"ZM",
			"ZW"
		],
		"isUnlisted": false,
		"hasYpcMetadata": false,
		"viewCount": "1413598276",
		"category": "Music",
		"publishDate": "2009-10-24",
		"ownerChannelName": "Rick Astley",
		"uploadDate": "2009-10-24",
		"videoId": "dQw4w9WgXcQ",
		"keywords": [
			"rick astley",
			"Never Gonna Give You Up",
			"nggyu",
			"never gonna give you up lyrics",
			"rick rolled",
			"Rick Roll",
			"rick astley official",
			"rickrolled",
			"Fortnite song",
			"Fortnite event",
			"Fortnite dance",
			"fortnite never gonna give you up",
			"rick roll",
			"rickrolling",
			"rick rolling",
			"never gonna give you up",
			"80s music",
			"rick astley new",
			"animated video",
			"rickroll",
			"meme songs",
			"never gonna give u up lyrics",
			"Rick Astley 2022",
			"never gonna let you down",
			"animated",
			"rick rolls 2022",
			"never gonna give you up karaoke"
		],
		"channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
		"isOwnerViewing": false,
		"isCrawlable": true,
		"allowRatings": true,
		"author": {
			"id": "UCuAXFkgsw1L7xaCfnd5JJOw",
			"name": "Rick Astley",
			"user": "@RickAstleyYT",
			"channel_url": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw",
			"external_channel_url": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw",
			"user_url": "http://www.youtube.com/@RickAstleyYT",
			"thumbnails": [
				{
					"url": "https://yt3.ggpht.com/49u8x4vdpP5McUU0fsQjb9Q2qTsHOOGJcRQETjtvT30_pyNocEnq94uwkAdyVr_a1XMhPg-yX6o=s48-c-k-c0x00ffffff-no-nd-rj",
					"width": 48,
					"height": 48
				},
				{
					"url": "https://yt3.ggpht.com/49u8x4vdpP5McUU0fsQjb9Q2qTsHOOGJcRQETjtvT30_pyNocEnq94uwkAdyVr_a1XMhPg-yX6o=s88-c-k-c0x00ffffff-no-nd-rj",
					"width": 88,
					"height": 88
				},
				{
					"url": "https://yt3.ggpht.com/49u8x4vdpP5McUU0fsQjb9Q2qTsHOOGJcRQETjtvT30_pyNocEnq94uwkAdyVr_a1XMhPg-yX6o=s176-c-k-c0x00ffffff-no-nd-rj",
					"width": 176,
					"height": 176
				}
			],
			"verified": false,
			"subscriber_count": 3730000
		},
		"isPrivate": false,
		"isUnpluggedCorpus": false,
		"isLiveContent": false,
		"media": {},
		"likes": null,
		"dislikes": null,
		"age_restricted": false,
		"video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
		"storyboards": [
			{
				"templateUrl": "https://i.ytimg.com/sb/dQw4w9WgXcQ/storyboard3_L0/default.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgjG6eqGBg%3D%3D&sigh=rs%24AOn4CLA8K6eoNau8Nrfvw75AEozRajkKrw",
				"thumbnailWidth": 48,
				"thumbnailHeight": 27,
				"thumbnailCount": 100,
				"interval": 0,
				"columns": 10,
				"rows": 10,
				"storyboardCount": 1
			},
			{
				"templateUrl": "https://i.ytimg.com/sb/dQw4w9WgXcQ/storyboard3_L1/M$M.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgjG6eqGBg%3D%3D&sigh=rs%24AOn4CLDwls9iec-gEpWRBfceqOR896b3VQ",
				"thumbnailWidth": 80,
				"thumbnailHeight": 45,
				"thumbnailCount": 108,
				"interval": 2000,
				"columns": 10,
				"rows": 10,
				"storyboardCount": 2
			},
			{
				"templateUrl": "https://i.ytimg.com/sb/dQw4w9WgXcQ/storyboard3_L2/M$M.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgjG6eqGBg%3D%3D&sigh=rs%24AOn4CLA7ioYvdz7gKhqPB3nVq40upUWrbw",
				"thumbnailWidth": 160,
				"thumbnailHeight": 90,
				"thumbnailCount": 108,
				"interval": 2000,
				"columns": 5,
				"rows": 5,
				"storyboardCount": 5
			}
		],
		"chapters": [],
		"thumbnails": [
			{
				"url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLDd2KtelLHaNSXrI9_5K-NvTscKNw",
				"width": 168,
				"height": 94
			},
			{
				"url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEbCMQBEG5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBUpEOOWUXWkNyijQuZ4UPzp2BE-w",
				"width": 196,
				"height": 110
			},
			{
				"url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEcCPYBEIoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBCyhr8AqpJ1SxKVU6SyK5ODJ_IpA",
				"width": 246,
				"height": 138
			},
			{
				"url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLB_p0PncTtkrhaNDZtntrE3gKkoYw",
				"width": 336,
				"height": 188
			},
			{
				"url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/maxresdefault.webp",
				"width": 1920,
				"height": 1080
			}
		]
	}
}
```

# Actor input Schema

## `youtubeUrls` (type: `array`):

Enter one or more YouTube video URLs that you want to convert to MP3

## `maxRequestRetries` (type: `integer`):

Maximum number of retry attempts if the download request fails

## `includeInfo` (type: `boolean`):

If enabled, includes video title, description, and other metadata in the output

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

Configure proxy settings to avoid rate limiting and improve reliability. We strongly recommend using residential proxies for the best performance.

## Actor input object example

```json
{
  "youtubeUrls": [
    {
      "url": "https://www.youtube.com/watch?v=jhFDyDgMVUI"
    }
  ],
  "maxRequestRetries": 25,
  "includeInfo": false,
  "proxyConfiguration": {
    "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 = {
    "youtubeUrls": [
        {
            "url": "https://www.youtube.com/watch?v=jhFDyDgMVUI"
        }
    ],
    "maxRequestRetries": 25,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("web.harvester/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 = {
    "youtubeUrls": [{ "url": "https://www.youtube.com/watch?v=jhFDyDgMVUI" }],
    "maxRequestRetries": 25,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    },
}

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

```

## MCP server setup

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