# Spotify Track Search Scraper (`codenest/spotify-track-search-scraper`) Actor

Input keywords or Spotify track URLs to scrape rich song metadata: track name, artists, album, duration, release date, and play counts. Outputs direct downloadable MP3 audio links, 30s previews, cover art, and clean structured dataset ready for Excel, CSV, or API integration.

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

## Pricing

from $3.00 / 1,000 track results

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 Tracks & Songs Pro Data Scraper

🎵 **Spotify Tracks & Songs Pro Data Scraper** — Search Spotify tracks by keyword or scrape full song metadata, artist details, album information, duration, playcounts, preview URLs, and audio playability. No Spotify API key required.

***

### ⚡ Key Highlights

- **Dual Extraction Modes**: Discover tracks by search keywords or extract deep metadata from direct Spotify track URLs and URIs (`spotify:track:...`).
- **Clean & Flat Output Structure**: Standardized, user-friendly JSON schema designed specifically for Excel, Google Sheets, Zapier, Make, and database ingestion (no bloat or nested GraphQL noise).
- **Audio Previews & Cover Art**: Direct high-resolution cover artwork and audio preview MP3 links when available.
- **Pay-Per-Event (PPE) Pricing**: Transparent, fair, and cost-effective pricing — pay only for what you scrape.
- **Generous Free Trial**: Test the actor for free (up to 5 tracks per run, 20 tracks lifetime) before upgrading.
- **Built-in Proxy Management**: Autonomous proxy handling with residential proxy support — runs reliably right out of the box.

***

### 💰 Pricing & Pay-Per-Event (PPE) Model

This actor uses Apify's **Pay-Per-Event (PPE)** pricing model. You only pay for successful results scraped:

| Event Name | Price (USD) | Description |
|---|---|---|
| `apify-actor-start` | **$0.00005** / run | Container initialization and proxy session setup |
| `result` | **$0.004** / track | Basic track search result (title, artist, album, URL, duration) |
| `detail` | **$0.004** / track | Full track enrichment (playcount, cover art, preview audio, extended metadata) |

> **Cost Breakdown:**
>
> - **Basic Search**: $0.004 / track ($4.00 per 1,000 tracks)
> - **Enriched Track (with Details / Direct URL)**: $0.008 / track ($8.00 per 1,000 tracks)

#### 🎁 Free Tier Policy

- Free users (`APIFY_USER_IS_PAYING != 1`) can scrape up to **5 tracks per run**, with a maximum lifetime limit of **20 tracks**.
- To scrape unlimited tracks and run high-volume batch jobs, simply subscribe to an Apify paid plan.

***

### ⚙️ Input Parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| **Search Keyword(s)** (`keyword`) | String / Array | - | Search query or list of keywords (e.g. `"Billie Eilish"`, `"rock classics"`). |
| **Spotify Track URIs / URLs** (`spotifyUris`) | String / Array | - | Direct Spotify URLs (e.g. `https://open.spotify.com/track/...`) or URIs (`spotify:track:...`). |
| **Search Limit** (`tracks_search_limit`) | Integer | `10` | Maximum tracks to fetch per keyword (1–50). |
| **Fetch Full Track Details** (`tracks_fetchDetails`) | Boolean | `true` | Enriches search results with playcount, preview audio, high-res artwork, and complete metadata. |

***

### 📊 Output Schema

Every exported record provides a clean, flat JSON structure optimized for analysis and spreadsheets:

| Field | Data Type | Description |
|---|---|---|
| `id` | String | Unique Spotify track ID |
| `name` | String | Song / track title |
| `artist` | String | Primary performing artist |
| `artists` | String / Array | All contributing and featured artists |
| `artist_id` | String / null | Unique Spotify artist identifier |
| `artist_url` | String / null | Direct Spotify web link to the artist |
| `album` | String | Album or single name |
| `album_id` | String | Spotify album identifier |
| `album_type` | String | Album type (`album`, `single`, `compilation`) |
| `album_url` | String | Direct Spotify web link to the album |
| `release_date` | String | Release date in ISO format (`YYYY-MM-DD`) |
| `duration_ms` | Integer | Total playback duration in milliseconds |
| `duration_formatted` | String | Human-readable duration (`MM:SS`) |
| `playcount` | Integer / null | Total stream count (where available) |
| `track_number` | Integer | Track position on album |
| `is_playable` | Boolean | Geographic streaming playability status |
| `is_explicit` | Boolean | Explicit content advisory flag |
| `copyright` | String / null | Record label / copyright notice |
| `preview_url` | String / null | Official Spotify MP3 audio preview streaming URL |
| `download_url` | String / null | Direct downloadable official MP3 audio file URL (CDN-hosted, zero 403 error) |
| `youtube_url` | String / null | Matching YouTube URL for full song streaming |
| `cover_art_url` | String | High-resolution album artwork URL |
| `url` | String | Direct Spotify web player URL (`https://open.spotify.com/track/...`) |
| `share_url` | String / null | Official Spotify share URL |
| `uri` | String | Spotify URI (`spotify:track:...`) |
| `search_query` | String / null | Search keyword used to find the track |

***

### 📋 Sample Output

```json
{
  "id": "6ZxrUCaynLgKSUudACOTwj",
  "name": "Cold",
  "artist": "Crossfade",
  "artists": "Crossfade",
  "artist_id": "0gxyHStUsqpMadRV0Di1Qt",
  "artist_url": "https://open.spotify.com/artist/0gxyHStUsqpMadRV0Di1Qt",
  "album": "Crossfade",
  "album_id": "1namjaJZ23ozXXB7X2d4hy",
  "album_type": "album",
  "album_url": "https://open.spotify.com/album/1namjaJZ23ozXXB7X2d4hy",
  "release_date": "2004-04-13",
  "duration_ms": 194226,
  "duration_formatted": "03:14",
  "playcount": 348760932,
  "track_number": 2,
  "is_playable": true,
  "is_explicit": false,
  "copyright": "© 2004 Sony BMG Music Entertainment",
  "preview_url": null,
  "download_url": "https://rr4---sn-gvcp5mp5u5-jb2z.googlevideo.com/videoplayback?expire=...",
  "youtube_url": "https://www.youtube.com/watch?v=Vrr3lRLjZ1Y",
  "cover_art_url": "https://i.scdn.co/image/ab67616d0000b2736655dcd1e8b57d0022f856e6",
  "url": "https://open.spotify.com/track/6ZxrUCaynLgKSUudACOTwj",
  "uri": "spotify:track:6ZxrUCaynLgKSUudACOTwj",
  "search_query": "cold"
}
```

***

### 💡 Best Practices & Tips

1. **Search Mode**: Input one or more keywords into **Search Keyword(s)** to discover and extract items across Spotify's catalog.
2. **Direct Extraction**: Paste exact Spotify URLs (e.g., `https://open.spotify.com/track/...`) or URIs (e.g., `spotify:track:...`) to fetch full metadata directly.
3. **Detail Enrichment**: Keep **Fetch Full Track Details** ON (`true`) to receive stream playcounts, high-res album art, and audio previews.
4. **Data Formats**: Download your dataset anytime from Apify Console in **JSON, CSV, Excel, XML, or HTML table format**.

# Actor input Schema

## `keyword` (type: `array`):

One or more search terms to find tracks on Spotify. Each keyword runs as a separate search.

💡 Leave empty and fill Spotify URIs below to use Get Details mode instead.

## `spotifyUris` (type: `array`):

One or more Spotify track URIs or URLs to fetch full metadata.
Examples: spotify:track:ID · https://open.spotify.com/track/ID

⚠️ Only track URIs/URLs are accepted. Other types (albums, artists, etc.) will be skipped.
💡 Leave empty and fill Search Keywords above to use Search mode instead.

## `tracks_search_limit` (type: `integer`):

Maximum number of track results to return per search keyword. Direct Spotify Track URIs / URLs are extracted independently and are not affected by this limit.

## `tracks_fetchDetails` (type: `boolean`):

📌 Search mode only — when using Track URIs/URLs, full details are always fetched automatically.

✅ When ON — runs getTrack for every search result. You get: play counts, content ratings (explicit/clean), lyrics availability, disc & track numbers, sharing info, preview playback URL, and full artist + album relationships.

❌ When OFF — you only get basic search data: track name, artist name, album name, duration, and URI. You will NOT get play counts, content ratings, or any detailed metadata.

⚠️ Slower — one extra API call per search result

## `tracks_downloadAudio` (type: `boolean`):

When ON — extracts direct high-bitrate downloadable audio stream URLs (m4a/mp3) and matching YouTube links for each Spotify track.

## `simulateFreeUser` (type: `boolean`):

Enable to simulate free user mode (5 tracks/run, 20 total lifetime limit) and test pay-per-event simulation logs, even when running from a paid Apify account.

## `resetFreeTierUsage` (type: `boolean`):

Enable to reset your test user's lifetime scraped count back to 0 in the tracking store for fresh testing.

## Actor input object example

```json
{
  "keyword": [
    "Rock",
    "Sun"
  ],
  "spotifyUris": [
    "spotify:track:0VjIjW4GlUZAMYd2vXMi3b",
    "https://open.spotify.com/track/7KA4W4McWYRpgf0fWsJZWB"
  ],
  "tracks_search_limit": 10,
  "tracks_fetchDetails": false,
  "tracks_downloadAudio": true,
  "simulateFreeUser": false,
  "resetFreeTierUsage": false
}
```

# Actor output Schema

## `results` (type: `string`):

Comprehensive list of Spotify tracks containing names, artists, albums, duration, play counts, cover images, and audio streams.

# 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 = {
    "keyword": [
        "Rock",
        "Sun"
    ],
    "spotifyUris": [
        "spotify:track:0VjIjW4GlUZAMYd2vXMi3b",
        "https://open.spotify.com/track/7KA4W4McWYRpgf0fWsJZWB"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("codenest/spotify-track-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 = {
    "keyword": [
        "Rock",
        "Sun",
    ],
    "spotifyUris": [
        "spotify:track:0VjIjW4GlUZAMYd2vXMi3b",
        "https://open.spotify.com/track/7KA4W4McWYRpgf0fWsJZWB",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("codenest/spotify-track-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 '{
  "keyword": [
    "Rock",
    "Sun"
  ],
  "spotifyUris": [
    "spotify:track:0VjIjW4GlUZAMYd2vXMi3b",
    "https://open.spotify.com/track/7KA4W4McWYRpgf0fWsJZWB"
  ]
}' |
apify call codenest/spotify-track-search-scraper --silent --output-dataset

```

## MCP server setup

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