# Spotify Top 50 and Viral Hits Playlist Scraper (`w3crawler/spotify-viral-charts-scraper`) Actor

Read ordered tracks from explicitly classified official Spotify Top 50 or Viral Hits playlists.

- **URL**: https://apify.com/w3crawler/spotify-viral-charts-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 viral charts

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 Top 50 and Viral Hits Playlist Scraper

Read ordered track rows from public Spotify chart-style playlists. Choose the Top 50 playlist for a supported country, or the public **Viral Hits** editorial playlist, and save track identity, artists, album, duration, explicit status, displayed play count, playlist position, and source provenance.

### Get started

1. Open the [Actor Store page](https://apify.com/w3crawler/spotify-viral-charts-scraper) and select **Try for free**, or open the **Input** tab.
2. Choose `chartType`: `top50` or `viral-hits`.
3. Choose `country`. Top 50 supports `global`, `US`, `GB`, `DE`, and `AU`; Viral Hits supports `global` only.
4. Set `maxItems`, start the Actor, and open the dataset. Export 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 |
| --- | --- | --- | --- | --- |
| `country` | string enum | Optional | `"global"` | Top 50 country selector: `global`, `US`, `GB`, `DE`, or `AU`. Viral Hits supports `global` only. |
| `chartType` | string enum | Optional | `"top50"` | `top50` chart playlist or `viral-hits` editorial playlist. Viral Hits is not Viral 50. |
| `market` | string | Optional | `"US"` | Two-letter market label recorded in every row. Playlist selection is controlled by `country` and `chartType`. |
| `maxItems` | integer | Optional | `50` | Maximum ordered playlist rows. 1–50. |
| `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
{
  "country": "global",
  "chartType": "top50",
  "market": "US",
  "maxItems": 50,
  "timeoutSecs": 30,
  "maxResponseBytes": 2000000,
  "requestDelayMs": 500,
  "maxRequestRetries": 1,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

`clientId` and `clientSecret` do not enable the official Web API and are not used for extraction. The Actor reads anonymous public playlist pages without login, token capture, audio download, or access-control bypass.

### Output

The dataset contains one `playlistTrack` row per saved 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 `playlistTrack`. |
| `position` | integer | Always | One-based position in the public playlist. |
| `chartType` | string enum | Always | Requested playlist family: `top50` or `viral-hits`. |
| `country` | string enum | Always | Requested country selector: `global`, `US`, `GB`, `DE`, or `AU`. |
| `playlistId` | string | Always | Public Spotify playlist ID used for the rows. |
| `trackId` | string | Always | Public Spotify track ID. |
| `trackName` | string | Always | Visible public track name. |
| `spotifyUrl` | string | Always | Canonical public Spotify track URL. |
| `artistNames` | string array | Always | Visible artist names in display order. |
| `artistIds` | string array | Always | Public Spotify artist IDs aligned to `artistNames`. |
| `albumName` | string | Always | Visible public album name. |
| `albumId` | string | Always | Public Spotify album ID. |
| `durationMs` | integer | Always | Track duration in milliseconds. |
| `explicit` | boolean | When published | True when the public row displays the explicit marker. |
| `playCount` | integer | Always | Public play count displayed for the chart row in the saved run. |
| `market` | string | Always | Requested market label. |
| `sourceUrl` | string | Always | Public playlist page used for the row. |
| `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 for the global Top 50 playlist. `position` is the playlist order, not a separate chart API rank.

```json
{
  "position": 3,
  "trackId": "70cHKK8bHAfJrOGVnfRG9J",
  "trackName": "Nicole Kidman",
  "spotifyUrl": "https://open.spotify.com/track/70cHKK8bHAfJrOGVnfRG9J",
  "artistNames": [
    "ADÉLA"
  ],
  "artistIds": [
    "2qanRMyA5bNuTvz1dK45OP"
  ],
  "albumName": "PRIMA",
  "albumId": "2yDFVH9CeOHt0sc9eI0aBs",
  "durationMs": 181000,
  "explicit": true,
  "playCount": 4952202,
  "recordId": "spotify_chart_top50_global_70cHKK8bHAfJrOGVnfRG9J",
  "recordType": "playlistTrack",
  "chartType": "top50",
  "country": "global",
  "playlistId": "37i9dQZEVXbMDoHDwVN2tF",
  "market": "US",
  "sourceUrl": "https://open.spotify.com/playlist/37i9dQZEVXbMDoHDwVN2tF",
  "scrapedAt": "2026-10-25T20:50:30.849Z"
}
```

### 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`. |
| `chartType` | Playlist family requested. |
| `country` | Country selector requested. |
| `playlistId` | Public playlist ID used. |
| `chartRecordCount` | Chart rows produced. |
| `recordsStored` | Rows saved to the dataset. |
| `errorRecordCount` | Error records; diagnostics are kept out of the dataset. |
| `failureCount` | Operational and dataset-write failures. |
| `maxItems` | Configured row cap. |
| `market` | Requested market label. |
| `sourceClassification` | Human-readable classification of the page, such as `official Top 50 playlist`. |
| `isViral50Chart` | Whether the run was classified as Viral 50; `false` in the saved Top 50 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` | Playlist 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 rendered track rows. |
| `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",
  "chartType": "top50",
  "country": "global",
  "playlistId": "37i9dQZEVXbMDoHDwVN2tF",
  "chartRecordCount": 5,
  "recordsStored": 5,
  "errorRecordCount": 0,
  "failureCount": 0,
  "maxItems": 5,
  "market": "US",
  "sourceClassification": "official Top 50 playlist",
  "isViral50Chart": false,
  "authenticationMode": "anonymous_public_page",
  "credentialFieldsIgnored": false,
  "startedAt": "2026-10-25T20:50:22.819Z",
  "completedAt": "2026-10-25T20:50:31.465Z",
  "durationMs": 8646,
  "outputWriteFailureCount": 0
}
```

### Coverage and limitations

The Actor reads one public playlist page per run. Top 50 supports `global`, `US`, `GB`, `DE`, and `AU`. **Viral Hits** is the public editorial playlist exposed under that name and is not the discontinued **Viral 50** chart; use `chartType: "viral-hits"` and `country: "global"`. `isViral50Chart` records the page classification and is `false` for the saved Top 50 run.

`position` is the order rendered by the public playlist, not a separately computed chart rank. `maxItems` caps the number of ordered rows and can truncate a playlist. `playCount` is saved only from a value displayed on the public row; it is not calculated from streams or estimated. `explicit` is omitted when no marker is shown. The Actor does not use the official Spotify Web API, credentials, login sessions, tokens, audio downloads, or access-control bypasses. `market` is a label and does not select the playlist. Missing tracks, region restrictions, playlist changes, and access challenges cannot be recovered.

### Usage and support

A run reads one playlist 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 confirm the playlist classification in the run summary before scaling. See the Actor's Pricing tab for current account rates.

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

# Actor input Schema

## `country` (type: `string`):

Supported Top 50 playlist country; Viral Hits supports global only.

## `chartType` (type: `string`):

Top 50 chart playlist or Viral Hits editorial playlist.

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

Two-letter official API market.

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

Maximum ordered playlist rows.

## `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
{
  "country": "global",
  "chartType": "top50",
  "market": "US",
  "maxItems": 50,
  "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-viral-charts-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-viral-charts-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-viral-charts-scraper --silent --output-dataset

```

## MCP server setup

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