# Spotify Play Count Scraper (`xtracto/spotify-play-count-scraper`) Actor

Get the per-track play count Spotify shows on its web player (not available in the official API) plus track and album metadata. Paste track or album links and get clean JSON.

- **URL**: https://apify.com/xtracto/spotify-play-count-scraper.md
- **Developed by:** [Farhan Febrian Nauval](https://apify.com/xtracto) (community)
- **Categories:** Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.99 / 1,000 results

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/platform/actors/running/actors-in-store#pay-per-event

## 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/docs.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.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/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 Play Count Scraper

Get the **per-track play count** Spotify shows on its web player — the big "plays" number next to each song — plus track and album details. This number is **not available in Spotify's official API**; this actor reads exactly what the web player displays.

Paste track or album links, press Run, and get clean JSON with play counts for every track.

### Why use this actor

- **The real play count** — the exact number shown on the Spotify web player, per track.
- **No account, no login, no API key** — just press Run.
- **Albums expand automatically** — give it an album link and get one row per track, each with its own play count.
- **Rich detail per track** — song name, artists, album, duration, explicit flag, and the full original data.
- **Accepts links, URIs, or bare IDs** — `https://open.spotify.com/track/...`, `spotify:album:...`, or a 22-character ID.
- **Clean, stable JSON** ready for spreadsheets, dashboards, databases, or reporting pipelines. Export to JSON, CSV, or Excel, and run it on a schedule.

### How it works

1. Paste one or more **track or album links** (or URIs / bare IDs).
2. For a **track**, the actor returns that track's play count and details. For an **album**, it returns every track on the album, each with its own play count.
3. Results stream into your dataset, ready to download as JSON, CSV, or Excel.

You don't manage any scrapers, servers, tokens, or logins — the actor handles all of that and retries automatically.

### Input

```json
{
  "albumOrTrackUrls": [
    "https://open.spotify.com/track/0DiWol3AO6WpXZgp0goxAV",
    "https://open.spotify.com/album/4m2880jivSbbyEGAKfITCa"
  ],
  "albumTrackLimit": 300,
  "maxConcurrency": 4
}
````

Using bare IDs instead of links:

```json
{
  "ids": ["0DiWol3AO6WpXZgp0goxAV"],
  "idType": "track"
}
```

| Field | Type | Description |
| --- | --- | --- |
| `albumOrTrackUrls` | array of strings | Spotify track or album links or `spotify:` URIs. Track vs album is auto-detected. Album inputs return one record per track. |
| `ids` | array of strings | Optional. 22-character Spotify IDs without the full URL. |
| `idType` | string | `track` or `album` — what the values in `ids` are. Ignored for full links/URIs. |
| `albumTrackLimit` | integer | Max tracks to return per album. Default `300`. |
| `maxConcurrency` | integer | How many tracks/albums to fetch in parallel. Default `4`. |
| `proxyConfiguration` | object | Optional. Not required for normal use. |

### Output

Every record carries a small header (`_input`, `_scrapedAt`, `_source`, `recordType`) and the fields you actually want (play count, name, artists, album), followed by `raw` — the full original object with all field names preserved.

#### Track input — `https://open.spotify.com/track/0DiWol3AO6WpXZgp0goxAV`

```json
{
  "_input": "https://open.spotify.com/track/0DiWol3AO6WpXZgp0goxAV",
  "_source": "S1-getTrack",
  "_scrapedAt": "2026-07-16T09:12:00Z",
  "recordType": "TRACK",
  "playcount": 934403466,
  "name": "One More Time",
  "artists": ["Daft Punk"],
  "albumName": "Discovery",
  "albumUri": "spotify:album:2noRn2Aes5aoNVsU6iWThc",
  "trackId": "0DiWol3AO6WpXZgp0goxAV",
  "uri": "spotify:track:0DiWol3AO6WpXZgp0goxAV",
  "durationMs": 320357,
  "explicit": false,
  "raw": { "__typename": "Track", "playcount": "934403466", "name": "One More Time", "...": "full track object" }
}
```

#### Album input — `https://open.spotify.com/album/4m2880jivSbbyEGAKfITCa`

One record per track. First two shown (13 total):

```json
{
  "_input": "https://open.spotify.com/album/4m2880jivSbbyEGAKfITCa",
  "_source": "S1-getAlbum",
  "_scrapedAt": "2026-07-16T09:12:00Z",
  "recordType": "TRACK",
  "playcount": 161318873,
  "name": "Give Life Back to Music",
  "artists": ["Daft Punk"],
  "albumName": "Random Access Memories",
  "albumUri": "spotify:album:4m2880jivSbbyEGAKfITCa",
  "trackNumber": 1,
  "discNumber": 1,
  "uri": "spotify:track:0dEIca2nhcxDUV8C5QkPYb",
  "durationMs": 275386,
  "explicit": false,
  "raw": { "playcount": "161318873", "name": "Give Life Back to Music", "...": "full track object" }
}
```

```json
{
  "_input": "https://open.spotify.com/album/4m2880jivSbbyEGAKfITCa",
  "_source": "S1-getAlbum",
  "_scrapedAt": "2026-07-16T09:12:00Z",
  "recordType": "TRACK",
  "playcount": 854213040,
  "name": "Instant Crush (feat. Julian Casablancas)",
  "artists": ["Daft Punk"],
  "albumName": "Random Access Memories",
  "albumUri": "spotify:album:4m2880jivSbbyEGAKfITCa",
  "trackNumber": 5,
  "discNumber": 1,
  "uri": "spotify:track:2cGxRwrMyEAp8dEbuZaVv6",
  "durationMs": 337560,
  "explicit": false,
  "raw": { "...": "... 11 more tracks in this album run" }
}
```

#### Key output fields

| Field | Type | Description |
| --- | --- | --- |
| `playcount` | number | The play count shown on the Spotify web player for this track. |
| `name` | string | Track title. |
| `artists` | array of strings | Artist name(s) on the track. |
| `albumName` | string | Album the track belongs to. |
| `albumUri` | string | Spotify URI of the album. |
| `uri` | string | Spotify URI of the track. |
| `trackId` | string | Track ID (track inputs). |
| `trackNumber` / `discNumber` | number | Position within the album (album inputs). |
| `durationMs` | number | Track length in milliseconds. |
| `explicit` | boolean | Whether the track is marked explicit. |
| `recordType` | string | Always `TRACK`. |
| `raw` | object | The full original track object, all field names preserved. |

On any failure the actor emits a `{_input, _source, _scrapedAt, _error, _errorDetail}` record instead of silently skipping.

### Notes & limits

- Play counts are a **live snapshot** at run time and update as Spotify updates them.
- Works with any public track or album — no account needed.
- Podcasts/episodes are not covered (Spotify doesn't publish play counts for those).
- For very large albums or compilations, raise `albumTrackLimit`.

# Actor input Schema

## `albumOrTrackUrls` (type: `array`):

Spotify track or album links (or spotify: URIs). Type is auto-detected. Album links return one record per track, each with its play count.

## `ids` (type: `array`):

Optional. 22-character Spotify IDs without the full URL. Use together with 'ID type' below to say whether they are tracks or albums.

## `idType` (type: `string`):

Whether the values in 'Bare IDs' are tracks or albums. Ignored for full URLs/URIs, which are auto-detected.

## `albumTrackLimit` (type: `integer`):

Maximum number of tracks to return for each album input. Default 300 (covers even large compilations).

## `maxConcurrency` (type: `integer`):

How many tracks/albums to fetch in parallel.

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

Optional. Not required for normal use. Defaults to the Apify Residential group.

## Actor input object example

```json
{
  "albumOrTrackUrls": [
    "https://open.spotify.com/track/0DiWol3AO6WpXZgp0goxAV",
    "https://open.spotify.com/album/4m2880jivSbbyEGAKfITCa"
  ],
  "ids": [],
  "idType": "track",
  "albumTrackLimit": 300,
  "maxConcurrency": 4,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "albumOrTrackUrls": [
        "https://open.spotify.com/track/0DiWol3AO6WpXZgp0goxAV",
        "https://open.spotify.com/album/4m2880jivSbbyEGAKfITCa"
    ],
    "ids": [],
    "idType": "track",
    "albumTrackLimit": 300,
    "maxConcurrency": 4
};

// Run the Actor and wait for it to finish
const run = await client.actor("xtracto/spotify-play-count-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 = {
    "albumOrTrackUrls": [
        "https://open.spotify.com/track/0DiWol3AO6WpXZgp0goxAV",
        "https://open.spotify.com/album/4m2880jivSbbyEGAKfITCa",
    ],
    "ids": [],
    "idType": "track",
    "albumTrackLimit": 300,
    "maxConcurrency": 4,
}

# Run the Actor and wait for it to finish
run = client.actor("xtracto/spotify-play-count-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 '{
  "albumOrTrackUrls": [
    "https://open.spotify.com/track/0DiWol3AO6WpXZgp0goxAV",
    "https://open.spotify.com/album/4m2880jivSbbyEGAKfITCa"
  ],
  "ids": [],
  "idType": "track",
  "albumTrackLimit": 300,
  "maxConcurrency": 4
}' |
apify call xtracto/spotify-play-count-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Spotify Play Count Scraper",
        "description": "Get the per-track play count Spotify shows on its web player (not available in the official API) plus track and album metadata. Paste track or album links and get clean JSON.",
        "version": "0.1",
        "x-build-id": "odDb8pglfkkb3RX2o"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/xtracto~spotify-play-count-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-xtracto-spotify-play-count-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/xtracto~spotify-play-count-scraper/runs": {
            "post": {
                "operationId": "runs-sync-xtracto-spotify-play-count-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/xtracto~spotify-play-count-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-xtracto-spotify-play-count-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",
                "properties": {
                    "albumOrTrackUrls": {
                        "title": "Track or album URLs / URIs",
                        "type": "array",
                        "description": "Spotify track or album links (or spotify: URIs). Type is auto-detected. Album links return one record per track, each with its play count.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "ids": {
                        "title": "Bare IDs (optional)",
                        "type": "array",
                        "description": "Optional. 22-character Spotify IDs without the full URL. Use together with 'ID type' below to say whether they are tracks or albums.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "idType": {
                        "title": "ID type (for bare IDs)",
                        "enum": [
                            "track",
                            "album"
                        ],
                        "type": "string",
                        "description": "Whether the values in 'Bare IDs' are tracks or albums. Ignored for full URLs/URIs, which are auto-detected.",
                        "default": "track"
                    },
                    "albumTrackLimit": {
                        "title": "Max tracks per album",
                        "minimum": 1,
                        "maximum": 2000,
                        "type": "integer",
                        "description": "Maximum number of tracks to return for each album input. Default 300 (covers even large compilations).",
                        "default": 300
                    },
                    "maxConcurrency": {
                        "title": "Max concurrent requests",
                        "minimum": 1,
                        "maximum": 12,
                        "type": "integer",
                        "description": "How many tracks/albums to fetch in parallel.",
                        "default": 4
                    },
                    "proxyConfiguration": {
                        "title": "Proxy",
                        "type": "object",
                        "description": "Optional. Not required for normal use. Defaults to the Apify Residential group.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
