# 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:** 57 total users, 6 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/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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(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 '{
  "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": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,magicfingers/spotify-scraper"
        }
    }
}

```

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/QA1C2Ue0E9Pnd0NFO/builds/Cod0XbUVrQvQwdJb4/openapi.json
