# Spotify Balanced Multi-Type Search Scraper (`w3crawler/spotify-trending-search-scraper`) Actor

Interleave official Spotify artist, track, album, and playlist search results without claiming a trend metric.

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

## Pricing

from $2.99 / 1,000 trending searches

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 Balanced Multi-Type Search Scraper

Interleave visible artist, track, album, and playlist cards from one public Spotify search into a balanced round-robin dataset. Every row carries a `balancedRank`, an explicit `rankBasis`, and a clear statement that the ordering is search presentation order rather than a proprietary trend or popularity score.

### Get started

1. Open the [Actor Store page](https://apify.com/w3crawler/spotify-trending-search-scraper) and select **Try for free**, or open the **Input** tab.
2. Enter a non-empty `query`.
3. Set `maxItems` to the total number of balanced rows you want. Keep the browser limits small 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

`query` 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 |
| --- | --- | --- | --- | --- |
| `query` | string | Required | Not supplied | Non-empty Spotify search text. 1–200 characters. |
| `market` | string | Optional | `"US"` | Two-letter market label recorded in output. The public page is read anonymously. |
| `maxItems` | integer | Optional | `40` | Total balanced cap across the four supported result types. 1–40. |
| `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 bytes accepted per response. 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
{
  "market": "US",
  "maxItems": 40,
  "timeoutSecs": 30,
  "maxResponseBytes": 2000000,
  "requestDelayMs": 500,
  "maxRequestRetries": 1,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

The default input omits the required `query` field; supply a search phrase before running. `clientId` and `clientSecret` do not enable the official Web API and are not used for extraction. The Actor reads anonymous public search pages without login, token capture, audio download, or access-control bypass.

### Output

The dataset contains one `balancedSearchResult` row per saved card, interleaved across the result types Spotify exposes. Optional card fields are omitted when absent, 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 `balancedSearchResult`. |
| `entityType` | string enum | Always | Result type: `artist`, `track`, `album`, or `playlist`. |
| `entityId` | string | Always | 22-character public Spotify entity ID. |
| `name` | string | Always | Visible public result name. |
| `url` | string | Always | Canonical public Spotify entity URL. |
| `imageUrl` | string | When published | Visible Spotify-hosted artwork URL. |
| `artistNames` | string | When published | Visible artist names joined as a comma-separated string. |
| `albumName` | string | When published | Visible album name. |
| `albumId` | string | When published | Public Spotify album ID when the card exposes an album link. |
| `releaseDate` | string | When published | Visible release year, year-month, or full date. |
| `durationFormatted` | string | When published | Visible track duration in `minutes:seconds` form. |
| `query` | string | Always | Normalized public Spotify search query. |
| `market` | string | Always | Normalized requested market label. |
| `balancedRank` | integer | Always | One-based rank after round-robin interleaving across result types. |
| `rankBasis` | string | Always | Ordering basis, always `publicSearchOrderRoundRobin`; not a trend score. |
| `sourceUrl` | string | Always | Rendered public Spotify search URL used for the row. |
| `scrapedAt` | string | Always | Time the row was saved, in ISO UTC. |

#### Full JSON output

The example below is an unchanged album row saved by the 2026-10-25 run. The `balancedRank` is the interleaved order, not an album chart position.

```json
{
  "entityType": "album",
  "entityId": "4Lkkfpt8ZkDmw4viHHi0IM",
  "name": "PITCOIN",
  "url": "https://open.spotify.com/album/4Lkkfpt8ZkDmw4viHHi0IM",
  "imageUrl": "https://i.scdn.co/image/ab67616d00001e02fb5868a9fc3d54f8f0b95b0a",
  "artistNames": "Pitbull",
  "albumName": "PITCOIN",
  "albumId": "4Lkkfpt8ZkDmw4viHHi0IM",
  "recordId": "spotify_trending_search_album_4Lkkfpt8ZkDmw4viHHi0IM",
  "recordType": "balancedSearchResult",
  "query": "Pitbull",
  "market": "US",
  "balancedRank": 3,
  "rankBasis": "publicSearchOrderRoundRobin",
  "sourceUrl": "https://open.spotify.com/search/Pitbull",
  "scrapedAt": "2026-10-25T20:47:49.692Z"
}
```

### 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`. |
| `runStatus` | Canonical run status; matches `status`. |
| `dataStatus` | `COMPLETE`, `PARTIAL`, `NO_RESULTS`, or `FAILED`. |
| `query` | Search query used. |
| `market` | Requested market label. |
| `maxItems` | Total balanced row cap. |
| `perTypeLimit` | Per-type allocation used for the round-robin pass. |
| `resultRecordCount` | Result rows produced. |
| `recordsStored` | Rows saved to the dataset. |
| `errorRecordCount` | Error records; diagnostics are kept out of the dataset. |
| `failureCount` | Operational and dataset-write failures. |
| `isTrendMetric` | Always `false`; the ordering is not a trend metric. |
| `rankBasis` | Ordering basis, `publicSearchOrderRoundRobin` in the saved run. |
| `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. |
| `outputWriteFailureCount` | Summary or optional key-value writes that failed. |

| Status | Data status | Meaning |
| --- | --- | --- |
| `SUCCEEDED` | `COMPLETE` | Balanced 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 search completed cleanly with no visible matching cards. |
| `FAILED` | `FAILED` | A fatal error occurred before any usable row was saved. |

Example `OUTPUT_SUMMARY` from the saved run:

```json
{
  "recordType": "runSummary",
  "status": "SUCCEEDED",
  "runStatus": "SUCCEEDED",
  "dataStatus": "COMPLETE",
  "query": "Pitbull",
  "market": "US",
  "maxItems": 4,
  "perTypeLimit": 1,
  "resultRecordCount": 4,
  "recordsStored": 4,
  "errorRecordCount": 0,
  "failureCount": 0,
  "isTrendMetric": false,
  "rankBasis": "publicSearchOrderRoundRobin",
  "authenticationMode": "anonymous_public_page",
  "credentialFieldsIgnored": false,
  "startedAt": "2026-10-25T20:47:37.508Z",
  "completedAt": "2026-10-25T20:47:50.450Z",
  "durationMs": 12942,
  "outputWriteFailureCount": 0
}
```

### Coverage and limitations

The Actor loads one public search page and interleaves the artist, track, album, and playlist cards that Spotify renders. `maxItems` is a total cap across those four types, not a per-type cap; the run summary records the resulting `perTypeLimit`. `balancedRank` is only the order produced by the round-robin pass and must not be presented as a trend, popularity, or chart metric.

The public page exposes a finite set of cards. The Actor does not paginate beyond the configured page actions, open every entity page, or infer missing results. A type can have fewer cards than its allocation. `market` is recorded as a label; the extraction path is the anonymous public page. Credential fields are accepted only for input compatibility and are ignored. Optional artwork, artist, album, release-date, and duration fields are omitted when the card does not expose them. Access challenges, redirects, and page changes cannot be recovered.

### Usage and support

A run uses one search page, so cost is driven mainly by browser startup, page size, navigation delay, and the number of retained rows. Start with a small `maxItems` value and inspect the balanced order before scaling. See the Actor's Pricing tab for current account rates.

Use the [Actor Issues page](https://apify.com/w3crawler/spotify-trending-search-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-trending-search-scraper/changelog.md

# Actor input Schema

## `query` (type: `string`):

Non-empty Spotify search text.

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

Two-letter official search market.

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

Total balanced cap; four current development-mode Search calls return at most 10 each.

## `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 accepted 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
{
  "market": "US",
  "maxItems": 40,
  "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.

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

No description

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

// Run the Actor and wait for it to finish
const run = await client.actor("w3crawler/spotify-trending-search-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-trending-search-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-trending-search-scraper --silent --output-dataset

```

## MCP server setup

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