# Spotify Scraper (`magicfingers/spotify-scraper`) Actor

Scrape Spotify podcasts, music tracks, artists, albums, and playlists. Search by keyword or provide direct URLs. Extract episodes, top tracks, discography, monthly listeners, and more.

- **URL**: https://apify.com/magicfingers/spotify-scraper.md
- **Developed by:** [abdulrahman alrashid](https://apify.com/magicfingers) (community)
- **Categories:** Social media
- **Stats:** 39 total users, 2 monthly users, 100.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/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Spotify Scraper

Scrape Spotify podcasts, music tracks, artists, albums, and playlists. Search by keyword or provide direct Spotify URLs to extract detailed data.

### What does Spotify Scraper do?

This actor extracts data from Spotify without requiring any API keys or authentication. It supports:

- **Search podcasts** by keyword — returns name, publisher, description, total episodes, cover art URL
- **Search tracks/artists/albums** by keyword — returns full metadata for each result
- **Podcast details** — all episodes with title, description, duration, release date
- **Artist profiles** — monthly listeners, genres, top tracks, full discography, related artists
- **Album details** — all tracks, release date, total duration, label, copyrights
- **Playlist contents** — all tracks with artist, album, duration, date added, position

### Input

| Field | Type | Description | Default |
|-------|------|-------------|---------|
| `mode` | string | Scraping mode (see below) | `searchPodcasts` |
| `searchQuery` | string | Search keyword(s) for search modes | — |
| `urls` | string[] | Spotify URLs for detail modes | `[]` |
| `maxResults` | integer | Maximum results to return | `50` |
| `includeEpisodes` | boolean | Fetch episodes for podcast details | `true` |
| `includeDiscography` | boolean | Fetch discography for artist details | `true` |
| `includeRelatedArtists` | boolean | Fetch related artists | `true` |
| `market` | string | ISO country code (US, GB, DE, etc.) | `US` |
| `proxyConfiguration` | object | Proxy settings | Apify Proxy |

#### Modes

| Mode | Description | Requires |
|------|-------------|----------|
| `searchPodcasts` | Search podcasts by keyword | `searchQuery` |
| `searchTracks` | Search music tracks by keyword | `searchQuery` |
| `searchArtists` | Search artists by keyword | `searchQuery` |
| `searchAlbums` | Search albums by keyword | `searchQuery` |
| `podcastDetails` | Scrape podcast + episodes | `urls` |
| `artistDetails` | Scrape artist profile + discography | `urls` |
| `albumDetails` | Scrape album + tracks | `urls` |
| `playlistDetails` | Scrape playlist + all tracks | `urls` |

### Example Input

#### Search for podcasts

```json
{
    "mode": "searchPodcasts",
    "searchQuery": "true crime",
    "maxResults": 25,
    "market": "US"
}
````

#### Scrape artist details

```json
{
    "mode": "artistDetails",
    "urls": [
        "https://open.spotify.com/artist/06HL4z0CvFAxyc27GXpf02"
    ],
    "maxResults": 100,
    "includeDiscography": true,
    "includeRelatedArtists": true
}
```

#### Scrape playlist tracks

```json
{
    "mode": "playlistDetails",
    "urls": [
        "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M"
    ],
    "maxResults": 500
}
```

#### Search for tracks

```json
{
    "mode": "searchTracks",
    "searchQuery": "lofi beats",
    "maxResults": 50,
    "market": "US"
}
```

### Example Output

#### Podcast search result

```json
{
    "type": "podcast",
    "id": "5CfCWKI5pZ28U0uOzXkDHe",
    "name": "The Joe Rogan Experience",
    "publisher": "Joe Rogan",
    "description": "The official podcast of comedian Joe Rogan.",
    "totalEpisodes": 2150,
    "explicit": false,
    "languages": ["en"],
    "coverArtUrl": "https://i.scdn.co/image/...",
    "spotifyUrl": "https://open.spotify.com/show/5CfCWKI5pZ28U0uOzXkDHe",
    "scrapedAt": "2024-01-15T10:30:00.000Z"
}
```

#### Track search result

```json
{
    "type": "track",
    "id": "4cOdK2wGLETKBW3PvgPWqT",
    "name": "Never Gonna Give You Up",
    "artists": [
        {
            "id": "0gxyHStUsqpMadRV0Di1Qt",
            "name": "Rick Astley",
            "spotifyUrl": "https://open.spotify.com/artist/0gxyHStUsqpMadRV0Di1Qt"
        }
    ],
    "album": {
        "id": "6eUW0wxWtzkFdaEFsTJto6",
        "name": "Whenever You Need Somebody",
        "releaseDate": "1987-11-12",
        "coverArtUrl": "https://i.scdn.co/image/..."
    },
    "durationMs": 213573,
    "duration": "3m 33s",
    "explicit": false,
    "popularity": 85,
    "spotifyUrl": "https://open.spotify.com/track/4cOdK2wGLETKBW3PvgPWqT",
    "scrapedAt": "2024-01-15T10:30:00.000Z"
}
```

### Pricing

This actor uses a pay-per-event pricing model:

- **$0.80 per 1,000 results** ($0.0008 per result)
- Search results, episodes, tracks, and entities each count as one result

### Rate Limits

The actor handles Spotify's rate limiting automatically with exponential backoff. For best results:

- Use Apify Proxy (residential recommended for high volume)
- Keep `maxResults` reasonable for your use case
- The actor respects a small delay between paginated requests

### Technical Details

- Uses Spotify's public Web API with anonymous access tokens (no API key required)
- Tokens are automatically refreshed when expired
- All data is returned as clean, structured JSON
- Supports pagination for large result sets (up to 10,000 items)
- Built with Apify SDK v3 and Crawlee

### Legal Notice

This actor is provided for educational and research purposes. Always review and comply with Spotify's Terms of Service before using scraped data commercially.

# Actor input Schema

## `mode` (type: `string`):

Choose what type of data to scrape.

## `searchQuery` (type: `string`):

Keyword(s) to search for. Used in search modes only.

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

Direct Spotify URLs to scrape. Used in detail modes (podcastDetails, artistDetails, albumDetails, playlistDetails). One URL per line.

## `maxResults` (type: `integer`):

Maximum number of results to return. For search modes, this limits search results. For detail modes, this limits items per entity (e.g., episodes per podcast).

## `includeEpisodes` (type: `boolean`):

When scraping podcast details, also fetch all episodes.

## `includeDiscography` (type: `boolean`):

When scraping artist details, include full discography (albums, singles, compilations).

## `includeRelatedArtists` (type: `boolean`):

When scraping artist details, include related artists.

## `market` (type: `string`):

ISO 3166-1 alpha-2 country code for market-specific data (e.g., US, GB, DE, JP).

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

Proxy settings for avoiding rate limits.

## Actor input object example

```json
{
  "mode": "searchPodcasts",
  "searchQuery": "technology",
  "urls": [],
  "maxResults": 5,
  "includeEpisodes": true,
  "includeDiscography": true,
  "includeRelatedArtists": true,
  "market": "US",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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 = {
    "mode": "searchPodcasts",
    "searchQuery": "technology",
    "urls": [],
    "maxResults": 5,
    "includeEpisodes": true,
    "includeDiscography": true,
    "includeRelatedArtists": true,
    "market": "US",
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("magicfingers/spotify-scraper").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 = {
    "mode": "searchPodcasts",
    "searchQuery": "technology",
    "urls": [],
    "maxResults": 5,
    "includeEpisodes": True,
    "includeDiscography": True,
    "includeRelatedArtists": True,
    "market": "US",
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("magicfingers/spotify-scraper").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 '{
  "mode": "searchPodcasts",
  "searchQuery": "technology",
  "urls": [],
  "maxResults": 5,
  "includeEpisodes": true,
  "includeDiscography": true,
  "includeRelatedArtists": true,
  "market": "US",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call magicfingers/spotify-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Spotify Scraper",
        "description": "Scrape Spotify podcasts, music tracks, artists, albums, and playlists. Search by keyword or provide direct URLs. Extract episodes, top tracks, discography, monthly listeners, and more.",
        "version": "1.0",
        "x-build-id": "Cod0XbUVrQvQwdJb4"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/magicfingers~spotify-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-magicfingers-spotify-scraper",
                "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/magicfingers~spotify-scraper/runs": {
            "post": {
                "operationId": "runs-sync-magicfingers-spotify-scraper",
                "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/magicfingers~spotify-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-magicfingers-spotify-scraper",
                "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": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Scraping Mode",
                        "enum": [
                            "searchPodcasts",
                            "searchTracks",
                            "searchArtists",
                            "searchAlbums",
                            "podcastDetails",
                            "artistDetails",
                            "albumDetails",
                            "playlistDetails"
                        ],
                        "type": "string",
                        "description": "Choose what type of data to scrape.",
                        "default": "searchPodcasts"
                    },
                    "searchQuery": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Keyword(s) to search for. Used in search modes only."
                    },
                    "urls": {
                        "title": "Spotify URLs",
                        "type": "array",
                        "description": "Direct Spotify URLs to scrape. Used in detail modes (podcastDetails, artistDetails, albumDetails, playlistDetails). One URL per line.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum number of results to return. For search modes, this limits search results. For detail modes, this limits items per entity (e.g., episodes per podcast).",
                        "default": 5
                    },
                    "includeEpisodes": {
                        "title": "Include Episodes",
                        "type": "boolean",
                        "description": "When scraping podcast details, also fetch all episodes.",
                        "default": true
                    },
                    "includeDiscography": {
                        "title": "Include Discography",
                        "type": "boolean",
                        "description": "When scraping artist details, include full discography (albums, singles, compilations).",
                        "default": true
                    },
                    "includeRelatedArtists": {
                        "title": "Include Related Artists",
                        "type": "boolean",
                        "description": "When scraping artist details, include related artists.",
                        "default": true
                    },
                    "market": {
                        "title": "Market / Country",
                        "type": "string",
                        "description": "ISO 3166-1 alpha-2 country code for market-specific data (e.g., US, GB, DE, JP).",
                        "default": "US"
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Proxy settings for avoiding rate limits."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
