# Spotify Playlist-Track Mapping Scraper (`w3crawler/spotify-playlist-track-mapping-scraper`) Actor

Map Spotify tracks to the playlists where they appear for graph datasets and placement tracking.

- **URL**: https://apify.com/w3crawler/spotify-playlist-track-mapping-scraper.md
- **Developed by:** [w3crawler](https://apify.com/w3crawler) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 playlist track mappings

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

## Spotify Playlist-Track Mapping Scraper

Map public Spotify playlist positions to individual tracks in a flat, relational dataset. Each row joins one playlist position to a track ID, track name, public track URL, artist identities, album context, duration, and source playlist, so the output can be loaded into a table or used to compare placements across playlists.

### Get started

1. Open the [Actor Store page](https://apify.com/w3crawler/spotify-playlist-track-mapping-scraper) and select **Try for free**, or open the **Input** tab.
2. Add one or more public Spotify playlist URLs or 22-character IDs to `playlistUrls`.
3. Set `maxTracks` to the number of positions you need per playlist. Keep the other defaults for the first run.
4. Start the Actor and open the dataset. Export the rows as JSON, CSV, or Excel. Open **Run summary** (`OUTPUT_SUMMARY`) to check the outcome and counts.

### Input

`playlistUrls` is required. All other fields are optional. Unsupported field names and out-of-range values are rejected before requests start.

| Field | Type | Required? | Default | Meaning |
| --- | --- | --- | --- | --- |
| `playlistUrls` | string array | Required | Not supplied | One to 20 public Spotify playlist URLs or IDs. 1–20 items, each 1–200 characters. Duplicates are processed by ID. |
| `maxTracks` | integer | Optional | `100` | Maximum playlist-item rows mapped per playlist. 1–500. |
| `market` | string | Optional | `"US"` | Two-letter market context copied to every row. It is not applied as a public-page filter. |
| `clientId` | string | Optional | Not supplied | Accepted for backward compatibility but ignored. Public anonymous-page extraction is always used. Up to 200 characters. |
| `clientSecret` | string | Optional | Not supplied | Accepted for backward compatibility but ignored. Public anonymous-page extraction is always used. Stored as a secret. |
| `timeoutSecs` | integer | Optional | `30` | Per-request timeout, in seconds. 5–60. |
| `maxResponseBytes` | integer | Optional | `2000000` | Maximum response size, in bytes. 100000–5000000. |
| `requestDelayMs` | integer | Optional | `500` | Delay before public-page navigation, in milliseconds. 0–30000. |
| `maxRequestRetries` | integer | Optional | `1` | Maximum retries for a failed public-page request. 0–3. |
| `proxyConfiguration` | object | Optional | `{"useApifyProxy":false}` | Optional Apify Proxy configuration for public pages. |

Full default input:

```json
{
  "maxTracks": 100,
  "market": "US",
  "timeoutSecs": 30,
  "maxResponseBytes": 2000000,
  "requestDelayMs": 500,
  "maxRequestRetries": 1,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

The default input omits the required `playlistUrls` field; supply at least one playlist before running. The Actor reads anonymous public Spotify playlist pages. `clientId` and `clientSecret` do not enable the official Web API and are not used for extraction.

### Output

The dataset contains one `playlistTrackMapping` row per observed playlist position. Optional information is omitted when the source does not publish it, and no diagnostic or placeholder rows are written.

| Field | Type | Availability | Meaning |
| --- | --- | --- | --- |
| `recordId` | string | Always | Stable Actor record key. |
| `recordType` | string | Always | Row discriminator, always `playlistTrackMapping`. |
| `playlistId` | string | Always | Public Spotify playlist ID. |
| `playlistName` | string | Always | Public playlist name. |
| `playlistUrl` | string | Always | Canonical public Spotify playlist URL. |
| `playlistOwner` | string | When published | Public playlist owner when visible. |
| `declaredItemCount` | integer | Always | Playlist item count exposed by the playlist header in the saved rows. |
| `position` | integer | Always | One-based track position in the playlist. |
| `addedAt` | string | When published | Public track-added timestamp when exposed. |
| `trackId` | string | Always | Public Spotify track ID. |
| `trackName` | string | Always | Public track name. |
| `trackUrl` | string | Always | Canonical public Spotify track URL. |
| `artistNames` | string | Always | Comma-separated public artist names in source order. |
| `artistIds` | string array | Always | Public artist IDs in source order. |
| `album` | string | Always | Public album name. |
| `albumId` | string | Always | Public Spotify album ID. |
| `imageUrl` | string | When published | Public artwork URL when exposed. |
| `releaseDate` | string | When published | Public release date when exposed. |
| `durationMs` | integer | Always | Track duration in milliseconds. |
| `explicit` | boolean | When published | Explicit marker when the public row visibly contains it. |
| `market` | string | Always | Requested two-letter market context. |
| `sourceUrl` | string | Always | Public playlist URL used as the mapping source. |
| `scrapedAt` | string | Always | Time the row was saved, in ISO UTC. |

#### Full JSON output

The example below is an unchanged row saved by the 2026-10-25 run. `artistNames` is a single comma-separated string, while `artistIds` is an array.

```json
{
  "position": 2,
  "trackId": "70cHKK8bHAfJrOGVnfRG9J",
  "trackName": "Nicole Kidman",
  "trackUrl": "https://open.spotify.com/track/70cHKK8bHAfJrOGVnfRG9J",
  "artistNames": "ADÉLA",
  "artistIds": [
    "2qanRMyA5bNuTvz1dK45OP"
  ],
  "album": "PRIMA",
  "albumId": "2yDFVH9CeOHt0sc9eI0aBs",
  "durationMs": 181000,
  "explicit": true,
  "recordId": "spotify_playlist_track_37i9dQZF1DXcBWIGoYBM5M_2_70cHKK8bHAfJrOGVnfRG9J",
  "recordType": "playlistTrackMapping",
  "playlistId": "37i9dQZF1DXcBWIGoYBM5M",
  "playlistName": "Today’s Top Hits",
  "playlistUrl": "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M",
  "declaredItemCount": 50,
  "market": "US",
  "sourceUrl": "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M",
  "scrapedAt": "2026-10-25T20:56:59.937Z"
}
```

### Run summary

**Run summary** is stored in the run's key-value store under `OUTPUT_SUMMARY`. The same object is mirrored to `OUTPUT` for compatibility.

| Field | Meaning |
| --- | --- |
| `recordType` | Always `runSummary`. |
| `status` | Actor process outcome: `SUCCEEDED` or `FAILED`. |
| `requestedPlaylistCount` | Playlist inputs requested. |
| `mappingRecordCount` | Mapping rows produced for the run. |
| `recordsStored` | Mapping rows saved to the dataset. |
| `errorRecordCount` | Error records; diagnostics are kept out of the dataset. |
| `maxTracks` | Configured per-playlist track bound. |
| `market` | Requested market context. |
| `authenticationMode` | Extraction mode, `anonymous_public_page` in the saved run. |
| `credentialFieldsIgnored` | Whether supplied compatibility credential fields were ignored. |
| `startedAt` | Run start time, in ISO UTC. |
| `completedAt` | Time the summary was written, in ISO UTC. |
| `durationMs` | Run duration in milliseconds. |
| `runStatus` | Canonical run status; matches `status`. |
| `dataStatus` | `COMPLETE`, `PARTIAL`, `NO_RESULTS`, or `FAILED`. |
| `failureCount` | Operational and dataset-write failures. |
| `outputWriteFailureCount` | Summary or optional key-value writes that failed. |

| Status | Data status | Meaning |
| --- | --- | --- |
| `SUCCEEDED` | `COMPLETE` | Rows were saved without an extraction problem. |
| `SUCCEEDED` | `PARTIAL` | Rows were saved, but a later problem prevented a complete run. Saved rows remain available. |
| `SUCCEEDED` | `NO_RESULTS` | The playlist completed cleanly with no observed positions. |
| `FAILED` | `FAILED` | A fatal error occurred before any usable row was saved. |

Example `OUTPUT_SUMMARY` from the saved run:

```json
{
  "recordType": "runSummary",
  "status": "SUCCEEDED",
  "requestedPlaylistCount": 1,
  "mappingRecordCount": 5,
  "recordsStored": 5,
  "errorRecordCount": 0,
  "maxTracks": 5,
  "market": "US",
  "authenticationMode": "anonymous_public_page",
  "credentialFieldsIgnored": false,
  "startedAt": "2026-10-25T20:56:51.897Z",
  "completedAt": "2026-10-25T20:57:00.518Z",
  "durationMs": 8621,
  "runStatus": "SUCCEEDED",
  "dataStatus": "COMPLETE",
  "failureCount": 0,
  "outputWriteFailureCount": 0
}
```

### Coverage and limitations

The Actor reads public playlist pages in an anonymous browser and emits mappings only for positions that Spotify renders. It does not emit a separate playlist metadata row and does not follow tracks or artists beyond the playlist page. `maxTracks` caps positions per playlist; a larger playlist can therefore be intentionally truncated. `artistNames` is a display string, not an array; use `artistIds` when joining to other datasets.

`market` is carried as context and is not used to filter the page. Credential fields are accepted only for input compatibility and are ignored; no official API route, login, private endpoint, token capture, or audio download is used. `playlistOwner`, `addedAt`, `imageUrl`, and `releaseDate` are omitted unless the public page exposes them. Missing tracks, private playlists, access challenges, and page changes cannot be recovered or inferred.

### Usage and support

Compute and storage charges vary with browser time, playlist count, `maxTracks`, and row count. Start with one playlist and a small `maxTracks` value, inspect the mapping rows and run summary, then scale. See the Actor's Pricing tab for current account rates.

Use the [Actor Issues page](https://apify.com/w3crawler/spotify-playlist-track-mapping-scraper/issues) to report a problem. Include the run ID, the input used, and the `OUTPUT_SUMMARY`; do not include tokens, cookies, or private data. This Actor is an independent community tool and is not affiliated with, sponsored by, or endorsed by Spotify. Use it only for public data and in accordance with Spotify's terms, robots guidance, and applicable law. Public pages can contain personal information; use the output only for lawful purposes.

# Changelog

This Actor's version history is a separate document: https://apify.com/w3crawler/spotify-playlist-track-mapping-scraper/changelog.md

# Actor input Schema

## `playlistUrls` (type: `array`):

One to 20 public Spotify playlist URLs or IDs.

## `maxTracks` (type: `integer`):

Maximum official playlist-item rows to map per playlist.

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

Two-letter market for official responses.

## `clientId` (type: `string`):

Accepted for backward compatibility but ignored; public anonymous-page extraction is always used.

## `clientSecret` (type: `string`):

Accepted for backward compatibility but ignored; public anonymous-page extraction is always used.

## `timeoutSecs` (type: `integer`):

Per-request timeout seconds.

## `maxResponseBytes` (type: `integer`):

Maximum bytes per response.

## `requestDelayMs` (type: `integer`):

Delay before public-page navigation in milliseconds.

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

Maximum retries for a failed public-page request.

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

Optional Apify Proxy configuration for public pages.

## Actor input object example

```json
{
  "playlistUrls": [
    "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M"
  ],
  "maxTracks": 100,
  "market": "US",
  "timeoutSecs": 30,
  "maxResponseBytes": 2000000,
  "requestDelayMs": 500,
  "maxRequestRetries": 1,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `runSummary` (type: `string`):

Run status and counters stored by the Actor.

## `compatibilitySummary` (type: `string`):

No description

## `sourceMetadata` (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 = {
    "playlistUrls": [
        "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("w3crawler/spotify-playlist-track-mapping-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 = { "playlistUrls": ["https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M"] }

# Run the Actor and wait for it to finish
run = client.actor("w3crawler/spotify-playlist-track-mapping-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 '{
  "playlistUrls": [
    "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M"
  ]
}' |
apify call w3crawler/spotify-playlist-track-mapping-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,w3crawler/spotify-playlist-track-mapping-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/ferm3eH0ESYyfw5f6/builds/sLgdMnj7ki7Mzp2PN/openapi.json
