# Spotify Genre Playlist Search and Discovery Scraper (`w3crawler/spotify-genre-discovery-scraper`) Actor

Search Spotify rendered public playlist results for genre terms and return bounded source-backed playlist cards with optional public detail enrichment; market is recorded context only.

- **URL**: https://apify.com/w3crawler/spotify-genre-discovery-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 genres

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 Genre Playlist Search and Discovery Scraper

Search Spotify's **public web player** for playlist results matching up to six genre terms. The Actor preserves the producing search URL and rendered position, removes duplicate playlist IDs across terms, and can open a bounded number of public playlist detail pages for owner, save-count, song-count, and duration fields.

### Get started

1. Open the [Actor Store page](https://apify.com/w3crawler/spotify-genre-discovery-scraper) and select **Try for free** or open the **Input** tab.
2. Set `genres` or keep the six default terms; set `market` only as output context.
3. Keep `maxItems` small and leave `includeDetails` on if you need owner and count metadata.
4. Start the Actor, open the dataset, and export the saved records as JSON, CSV, or Excel. Open **Run summary** (`OUTPUT_SUMMARY`) to check the outcome and counts.

### Input

All fields are optional; the defaults below are ready to use. Unsupported field names and out-of-range values are rejected before requests start.

| Field | Type | Required? | Default | Meaning |
| --- | --- | --- | --- | --- |
| `genres` | string array | Optional | `["pop","mood","hip-hop","latin","classical","ambient"]` | One to six public Spotify playlist-search terms, searched in order. Duplicate playlist IDs are removed globally. |
| `market` | string | Optional | `US` | Two-letter context retained in each result. The public search route is not market-filtered by this Actor, so `marketApplied` is always `false`. |
| `maxItems` | integer | Optional | `10` | Global maximum rows across all genre terms and scroll passes, 1–50. |
| `maxPages` | integer | Optional | `1` | Maximum bounded scroll passes per genre search, 1–3. This is not a URL page number. |
| `includeDetails` | boolean | Optional | `true` | Visit public playlist detail pages for up to `maxDetailItems` selected records. |
| `maxDetailItems` | integer | Optional | `2` | Global maximum detail pages, 0–10. A detail failure preserves the search record. |
| `requestDelayMs` | integer | Optional | `250` | Minimum delay after scrolling and between retry attempts, 0–5000 ms. |
| `timeoutSecs` | integer | Optional | `45` | Bounded timeout for each public navigation and main-content wait, 10–90 seconds. |
| `maxRetries` | integer | Optional | `1` | Finite retries for transient public-page failures, 0–2. Access challenges, redirects, size failures, and explicit 4xx responses are not retried. |
| `maxResponseBytes` | integer | Optional | `2000000` | Maximum rendered HTML size inspected per page, 100000–5000000 bytes. |

Full default input:

```json
{
  "genres": [
    "pop",
    "mood",
    "hip-hop",
    "latin",
    "classical",
    "ambient"
  ],
  "market": "US",
  "maxItems": 10,
  "maxPages": 1,
  "includeDetails": true,
  "maxDetailItems": 2,
  "requestDelayMs": 250,
  "timeoutSecs": 45,
  "maxRetries": 1,
  "maxResponseBytes": 2000000
}
```

The Actor reads anonymous, public Spotify search and playlist pages. It does not log in, call the official Web API, capture Web Player tokens, download audio, or bypass access challenges.

### Output

The dataset contains one `genrePlaylistSearchResult` row per unique playlist. Optional values are omitted rather than inferred, and no diagnostic or placeholder rows are written.

| Field | Type | Availability | Meaning |
| --- | --- | --- | --- |
| `recordId` | string | Always | Stable key derived from the normalized genre query and playlist ID. |
| `recordType` | string | Always | Row discriminator; always `genrePlaylistSearchResult`. |
| `genreQuery` | string | Always | User-supplied genre term that produced the search URL. |
| `genreQueryNormalized` | string | Always | Lowercase form used in record identity and deduplication. |
| `requestedMarket` | string | Always | Market context supplied by the user; it is not applied to Spotify's public search route. |
| `marketApplied` | boolean | Always | Always `false` for this public search workflow. |
| `searchUrl` | string | Always | Rendered public Spotify search URL that produced the result. |
| `searchPage` | integer | Always | Scroll pass that produced the result, at least 1. |
| `position` | integer | Always | One-based position in the observed rendered search list, at least 1. |
| `playlistId` | string | Always | 22-character public Spotify playlist ID. |
| `name` | string | Always | Playlist name visible in the search card. |
| `ownerName` | string | When the card or detail page shows it | Public playlist owner name. |
| `ownerId` | string | When the detail page exposes it | Public Spotify user identifier. |
| `ownerUrl` | string | When the detail page exposes it | Public Spotify user URL. |
| `spotifyUrl` | string | Always | Canonical `https://open.spotify.com/playlist/<id>` URL. |
| `imageUrl` | string | When the search card shows artwork | Public playlist artwork URL. |
| `declaredSaveCount` | integer | When a detail page exposes a save count | Declared save count, at least 0. |
| `declaredItemCount` | integer | When a detail page exposes an item count | Declared song or item count, at least 0. |
| `trackCount` | integer | When a detail page exposes an item count | Alias of the publicly declared song count; not inferred from a partial track list. |
| `durationHours` | number | When the detail page shows an hour value | Playlist duration in hours, at least 0. |
| `durationText` | string | When the detail page shows duration | Source text for the displayed duration. |
| `isPublicPlaylist` | boolean | When the detail page labels it | Whether the playlist is explicitly labeled public. |
| `detailRequested` | boolean | Always | Whether this result used one of the bounded detail-page slots. |
| `detailEnriched` | boolean | Always | Whether public detail-page fields were successfully read. |
| `detailStatus` | string | Always | `not_requested`, `available`, or `failed`. |
| `detailErrorCode` | string | When detail enrichment fails | Stable bounded error code. |
| `detailErrorMessage` | string | When detail enrichment fails | Bounded non-secret error message. |
| `scrapedAt` | string | Always | Time the normalized result was emitted, in ISO UTC. |

#### Full JSON output

The example below is a real saved row from the 2026-10-25 verification run. Detail fields appear only on rows that received one of the bounded detail-page slots.

```json
{
  "recordId": "spotify_genre_pop_1lvD3XTXCHx0VjXNbl49XF",
  "recordType": "genrePlaylistSearchResult",
  "genreQuery": "pop",
  "genreQueryNormalized": "pop",
  "requestedMarket": "US",
  "marketApplied": false,
  "searchUrl": "https://open.spotify.com/search/pop/playlists",
  "searchPage": 1,
  "position": 1,
  "playlistId": "1lvD3XTXCHx0VjXNbl49XF",
  "name": "POP LATINO : 90s, 2000s & 2010s Hits",
  "ownerName": "Filtr Éxitos",
  "ownerId": "mejoresplaylistsspotify",
  "ownerUrl": "https://open.spotify.com/user/mejoresplaylistsspotify",
  "spotifyUrl": "https://open.spotify.com/playlist/1lvD3XTXCHx0VjXNbl49XF",
  "imageUrl": "https://image-cdn-fa.spotifycdn.com/image/ab67706c0000da849d3e6e99c5fc7f006c66232c",
  "declaredSaveCount": 575141,
  "declaredItemCount": 195,
  "trackCount": 195,
  "durationHours": 11,
  "durationText": "11 hr",
  "isPublicPlaylist": true,
  "detailRequested": true,
  "detailEnriched": true,
  "detailStatus": "available",
  "scrapedAt": "2026-10-25T21:03:35.369Z"
}
```

### Run summary

**Run summary** is stored in the run's key-value store under `OUTPUT_SUMMARY`; the same object is also written to `OUTPUT`. It records query, search, detail, and deduplication counts.

| Field | Meaning |
| --- | --- |
| `recordType` | Always `runSummary`. |
| `status` | Actor outcome: `SUCCEEDED` or `FAILED`. |
| `requestedGenres` | Genre terms requested for the run. |
| `requestedGenreCount` | Number of requested genre terms. |
| `genresSearched` | Genre terms actually searched. |
| `requestedMarket` | Market context supplied by the user. |
| `marketApplied` | Always `false` for this public search route. |
| `maxItems` | Global row limit used for the run. |
| `maxPagesPerGenre` | Scroll-pass limit used per genre. |
| `includeDetails` | Whether detail enrichment was requested. |
| `maxDetailItems` | Detail-page budget used for the run. |
| `searchPagesProcessed` | Search scroll passes processed. |
| `searchCandidateCount` | Playlist candidates observed before deduplication. |
| `duplicateCount` | Duplicate playlist results removed. |
| `detailRequestedCount` | Detail pages requested. |
| `detailSuccessCount` | Detail pages enriched successfully. |
| `detailFailureCount` | Detail pages that failed. |
| `playlistRecordCount` | Playlist records produced. |
| `recordsStored` | Playlist rows saved to the dataset. |
| `diagnosticCount` | Operational issues recorded for the run. |
| `extractionMode` | Fixed value `rendered_public_spotify_search`. |
| `paginationMode` | Fixed value `bounded_scroll_passes_per_genre`. |
| `publicPagePolicy` | Public-page boundary recorded for the run. |
| `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` | Completeness of saved rows: `COMPLETE`, `PARTIAL`, `NO_RESULTS`, or `FAILED`. |
| `failureCount` | Operational failures and failed dataset writes. |
| `outputWriteFailureCount` | Summary or optional key-value writes that failed. |

| Status | Data status | Meaning |
| --- | --- | --- |
| `SUCCEEDED` | `COMPLETE` | Eligible playlists were saved without an extraction problem. |
| `SUCCEEDED` | `PARTIAL` | At least one row was saved, but a later search, detail page, or output write failed. Saved rows remain available. |
| `SUCCEEDED` | `NO_RESULTS` | The searches completed cleanly and returned no matching playlists. |
| `FAILED` | `FAILED` | The run failed before any usable playlist row was saved. |

Example `OUTPUT_SUMMARY` from the saved run (also written to `OUTPUT`):

```json
{
  "recordType": "runSummary",
  "status": "SUCCEEDED",
  "requestedGenres": [
    "pop"
  ],
  "requestedGenreCount": 1,
  "genresSearched": 1,
  "requestedMarket": "US",
  "marketApplied": false,
  "maxItems": 5,
  "maxPagesPerGenre": 1,
  "includeDetails": true,
  "maxDetailItems": 2,
  "searchPagesProcessed": 1,
  "searchCandidateCount": 29,
  "duplicateCount": 0,
  "detailRequestedCount": 2,
  "detailSuccessCount": 2,
  "detailFailureCount": 0,
  "playlistRecordCount": 5,
  "recordsStored": 5,
  "diagnosticCount": 0,
  "extractionMode": "rendered_public_spotify_search",
  "paginationMode": "bounded_scroll_passes_per_genre",
  "publicPagePolicy": "anonymous rendered public Spotify pages only; no login, official Web API, token capture, audio download, or access-control bypass.",
  "startedAt": "2026-10-25T21:03:28.422Z",
  "completedAt": "2026-10-25T21:03:38.171Z",
  "durationMs": 9749,
  "runStatus": "SUCCEEDED",
  "dataStatus": "COMPLETE",
  "failureCount": 0,
  "outputWriteFailureCount": 0
}
```

### Coverage and limitations

Search uses Spotify's public `/search/<genre>/playlists` route, not an API endpoint. `maxPages` counts bounded scroll passes, not URL pages, and `maxItems` is global across all genre terms; later terms can therefore add fewer rows or none. Duplicate playlist IDs are removed across terms, keeping the first observed result.

Detail enrichment is optional and strictly budgeted by `maxDetailItems`. Owner IDs, save counts, song counts, durations, and public-status labels are available only when a detail page exposes them; a failed detail page leaves the usable search row in place with `detailStatus: "failed"`. The Actor never reads playlist track lists.

`market` is recorded as `requestedMarket` but not applied: every row reports `marketApplied: false`, and rendered results can vary by locale, time, and Spotify's search ranking. Access challenges or empty pages are logged and counted, never converted into dataset rows.

### Usage and support

Apify compute and storage costs vary with browser time, the number of genre terms and scroll passes, and how many detail pages are opened. Set `includeDetails` to `false` or `maxDetailItems` to `0` for a search-only run; start with one or two genres and a small `maxItems`, then scale gradually. See the Actor's Pricing tab for current account rates.

Use the [Actor Issues page](https://apify.com/w3crawler/spotify-genre-discovery-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, endorsed by, or sponsored by Spotify. Use it only for public data and in accordance with Spotify's terms, robots guidance, and applicable law.

# Changelog

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

# Actor input Schema

## `genres` (type: `array`):

One through six public Spotify playlist-search terms. Terms are searched in order, and duplicate playlist IDs are removed globally. Defaults to pop, mood, hip-hop, latin, classical, and ambient.

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

Two-letter context retained in each result. Spotify's public search route does not accept this Actor's market as a source-selection filter, so marketApplied is always false.

## `maxItems` (type: `integer`):

Global maximum across all genre terms and rendered search passes.

## `maxPages` (type: `integer`):

Maximum bounded scroll passes for each genre search. The public Spotify page may load more cards after scrolling; this is not a URL page number.

## `includeDetails` (type: `boolean`):

Visit public playlist detail pages for up to maxDetailItems selected records to collect owner, save count, song count, and duration when visible.

## `maxDetailItems` (type: `integer`):

Global maximum number of public playlist detail pages. A detail failure preserves the search record with detailEnriched false.

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

Minimum delay used after scrolling and between retry attempts. The Actor also waits for rendered page content.

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

Bounded timeout in seconds for each public page navigation and main-content wait.

## `maxRetries` (type: `integer`):

Finite retries for transient public-page failures. Access challenges, redirects, response-size failures, and explicit 4xx responses are not retried.

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

Maximum rendered HTML size inspected per public page.

## Actor input object example

```json
{
  "genres": [
    "pop",
    "mood",
    "hip-hop",
    "latin",
    "classical",
    "ambient"
  ],
  "market": "US",
  "maxItems": 10,
  "maxPages": 1,
  "includeDetails": true,
  "maxDetailItems": 2,
  "requestDelayMs": 250,
  "timeoutSecs": 45,
  "maxRetries": 1,
  "maxResponseBytes": 2000000
}
```

# Actor output Schema

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

Public playlist search results and optional detail-enrichment fields.

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

Run and data statuses, pagination counts, detail outcomes, and diagnostic totals.

## `sourceMetadata` (type: `string`):

Public-page transport and safety declarations.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("w3crawler/spotify-genre-discovery-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("w3crawler/spotify-genre-discovery-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 '{}' |
apify call w3crawler/spotify-genre-discovery-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,w3crawler/spotify-genre-discovery-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/XRVCB1AQzcJSPqz2e/builds/vM14yeUFKdsPYWV4g/openapi.json
