# Spotify Music Downloader (`scraper-mind/spotify-music-downloader`)

Spotify Music Downloader 🎵 is a fast and reliable tool for downloading Spotify tracks in 320kbps high-quality audio. It extracts metadata, including track title, artist, album, and cover image, providing instant download links for offline listening.

- **URL**: https://beta-securitybyobscurity.apify.com/scraper-mind/spotify-music-downloader.md
- **Developed by:** [Scraper Mind](https://beta-securitybyobscurity.apify.com/scraper-mind) (community)
- **Categories:** Social media, Videos, Automation
- **Stats:** 44 total users, 8 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.
You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

# README

\#Spotify Music Downloader 🎵🚀 - Fast & Reliable Track Downloads

### 🎧 Overview

**Spotify Music Downloader** is the ultimate tool for downloading **Spotify tracks** quickly and efficiently. Whether you're saving your favorite songs for offline listening or archiving high-quality audio, this downloader guarantees **ultra-fast processing**, **reliable downloads**, and **superior audio quality**. Please note: this tool supports **only Spotify track downloads**. It does not support albums, playlists, podcasts, or artist pages.

***

### 🔥 Key Features

- **🎶 Track-Only Downloads**\
  Exclusively supports Spotify track URLs (e.g., `https://open.spotify.com/track/…`), ensuring precise and reliable downloads.

- **🎵 High-Quality Audio Conversion**\
  Downloads the best available audio stream and converts it to MP3 at **320kbps** for an optimal listening experience.

- **⚡ Ultra-Fast Processing**\
  Get your downloadable audio links in seconds, even when processing multiple track URLs.

- **🔎 Detailed Metadata Extraction**\
  Retrieves comprehensive track details including:
  - `track_title`
  - `artist`
  - `album`
  - `duration`
  - `cover_image`
  - `downloadable_audio_link`

- **🔒 Secure & Scalable**\
  Built on the robust Apify platform with proxy support, ensuring secure downloads and scalability for bulk processing.

- **🛠️ Developer-Friendly API**\
  Seamlessly integrates with your automation workflows. Simply provide a JSON input of track URLs and receive ready-to-use download links.

***

### 📜 How It Works

1. **Input Validation:**\
   Only Spotify track URLs are accepted. If a URL does not include the required `https://open.spotify.com/track/` substring, it is automatically rejected. This ensures that users get the correct, high-quality audio without errors.

2. **Dynamic Page Rendering:**\
   Using headless Playwright, the tool fully renders the Spotify page. This allows the actor to extract complete and accurate metadata, even from JavaScript-heavy pages.

3. **Metadata Extraction:**\
   The actor retrieves essential metadata—such as track title, artist, album, duration, and cover image—from JSON-LD data and fallback meta tags. If needed, it also parses the page’s `<title>` tag to ensure accurate information.

4. **Audio Processing:**\
   With yt-dlp and FFmpeg, the best available audio is downloaded and converted to a high-quality MP3 file (320kbps). Proper ID3 tags are added to enrich the file with metadata.

5. **File Upload & Direct Download:**\
   The processed audio file is then uploaded to Apify’s key-value store, and a secure, direct download link is generated for immediate access.

***

### 📂 Input & Output Examples

#### 📂 **Input JSON Example:**

```json
{
  "track_urls": [
    {
      "url": "https://open.spotify.com/track/3KkXRkHbMCARz0aVfEt68P?si=6c6a47f41b754f4e"
    }
  ],
  "yt_dlp_cookies_path": "",
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"],
    "apifyProxyCountry": "US"
  }
}
```

#### 📂 **Output JSON Example:**

```json
[
    {
        "track_title": "Blinding Lights",
        "artist": "The Weeknd",
        "album": "After Hours",
        "duration": "3:20",
        "cover_image": "https://i.scdn.co/image/ab67616d0000b2735c5f4c08e03d5f3f9b84e3f4",
        "Download Audio": "https://api.apify.com/v2/key-value-stores/<storeId>/records/Blinding_Lights_-_The_Weeknd__OFFICIAL_AUDIO_.mp3"
    }
]
```

***

### 🏡 Getting Started

1. **Deploy the Actor:**\
   Subscribe and deploy the **Spotify Music Downloader** actor on the Apify platform.

2. **Prepare Your Input:**\
   Use the provided input JSON example. Remember: **only Spotify track URLs are allowed**. The input editor enforces this with a built-in regex validation.

3. **Run the API:**\
   Execute the actor. It will render the Spotify page, extract metadata, process the audio file, and return a direct download link.

4. **Download & Enjoy:**\
   Use the provided link to download your track in high-quality MP3 format. Integrate the link in your apps or listen offline at your convenience.

***

### 📢 Need Help? Contact Us!

Our support team is available 24/7 to assist with any inquiries or custom requests. For specialized features or troubleshooting, please reach out at:

- **Email:** <support@example.com>

### 🚀 Unlock the Power of Spotify Music Downloader

Experience the fastest, most reliable Spotify track downloads today. With our dedicated tool, enjoy your favorite songs offline with unparalleled quality and efficiency. Download your favorite tracks now with **Spotify Music Downloader**!

````

---

# Actor input Schema

## `track_urls` (type: `array`):

List of Spotify track URLs to process.
## `yt_dlp_cookies_path` (type: `string`):

Optional. Provide the path to a cookies file for yt-dlp.
## `proxy` (type: `object`):

Configure proxies for this Actor. Only Residential (default) and Own proxies are available.

## Actor input object example

```json
{
  "track_urls": [
    {
      "url": "https://open.spotify.com/track/3KkXRkHbMCARz0aVfEt68P?si=6c6a47f41b754f4e"
    },
    {
      "url": "https://open.spotify.com/track/7lQWRAjyhTpCWFC0jmclT4?si=df7aa0062e484ae9"
    }
  ],
  "proxy": {
    "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 = {
    "track_urls": [
        {
            "url": "https://open.spotify.com/track/3KkXRkHbMCARz0aVfEt68P?si=6c6a47f41b754f4e"
        },
        {
            "url": "https://open.spotify.com/track/7lQWRAjyhTpCWFC0jmclT4?si=df7aa0062e484ae9"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scraper-mind/spotify-music-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 = { "track_urls": [
        { "url": "https://open.spotify.com/track/3KkXRkHbMCARz0aVfEt68P?si=6c6a47f41b754f4e" },
        { "url": "https://open.spotify.com/track/7lQWRAjyhTpCWFC0jmclT4?si=df7aa0062e484ae9" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("scraper-mind/spotify-music-downloader").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 '{
  "track_urls": [
    {
      "url": "https://open.spotify.com/track/3KkXRkHbMCARz0aVfEt68P?si=6c6a47f41b754f4e"
    },
    {
      "url": "https://open.spotify.com/track/7lQWRAjyhTpCWFC0jmclT4?si=df7aa0062e484ae9"
    }
  ]
}' |
apify call scraper-mind/spotify-music-downloader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=scraper-mind/spotify-music-downloader",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Spotify Music Downloader",
        "description": "Spotify Music Downloader 🎵 is a fast and reliable tool for downloading Spotify tracks in 320kbps high-quality audio. It extracts metadata, including track title, artist, album, and cover image, providing instant download links for offline listening.",
        "version": "1.0",
        "x-build-id": "tP0Ocx3OF2rf1Vwe3"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scraper-mind~spotify-music-downloader/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scraper-mind-spotify-music-downloader",
                "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/scraper-mind~spotify-music-downloader/runs": {
            "post": {
                "operationId": "runs-sync-scraper-mind-spotify-music-downloader",
                "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/scraper-mind~spotify-music-downloader/run-sync": {
            "post": {
                "operationId": "run-sync-scraper-mind-spotify-music-downloader",
                "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": [
                    "track_urls"
                ],
                "properties": {
                    "track_urls": {
                        "title": "Spotify Track URLs",
                        "type": "array",
                        "description": "List of Spotify track URLs to process.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "pattern": "^https://open\\.spotify\\.com/track/"
                                }
                            },
                            "required": [
                                "url"
                            ]
                        }
                    },
                    "yt_dlp_cookies_path": {
                        "title": "yt-dlp Cookies Path",
                        "type": "string",
                        "description": "Optional. Provide the path to a cookies file for yt-dlp."
                    },
                    "proxy": {
                        "title": "Proxy Configuration",
                        "required": [
                            "useApifyProxy",
                            "apifyProxyGroups",
                            "apifyProxyCountry"
                        ],
                        "type": "object",
                        "description": "Configure proxies for this Actor. Only Residential (default) and Own proxies are available.",
                        "properties": {
                            "useApifyProxy": {
                                "title": "Use Apify Proxy",
                                "type": "boolean",
                                "default": true
                            },
                            "apifyProxyGroups": {
                                "title": "Proxy Groups",
                                "type": "array",
                                "description": "Select one or more proxy groups.",
                                "items": {
                                    "type": "string",
                                    "enum": [
                                        "RESIDENTIAL",
                                        "OWN_PROXIES"
                                    ]
                                },
                                "default": [
                                    "RESIDENTIAL"
                                ]
                            },
                            "apifyProxyCountry": {
                                "title": "Proxy Country",
                                "type": "string",
                                "description": "Select the country for your proxy.",
                                "default": "US"
                            }
                        },
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ],
                            "apifyProxyCountry": "US"
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
