# iTunes Music Scraper (`crawlergang/itunes-music-scraper`) Actor

Search 8M+ tracks on Apple iTunes with track search, trending charts, artist/album/track lookup. Free Apple REST API, no auth, no proxy required.

- **URL**: https://apify.com/crawlergang/itunes-music-scraper.md
- **Developed by:** [Crawler Gang](https://apify.com/crawlergang) (community)
- **Categories:** Developer tools, Other, Automation
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 11 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $3.00 / 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.md):

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

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

## iTunes Music Scraper

Search over **8 million tracks** on Apple's iTunes catalog and Apple Music charts. This actor uses Apple's free, public iTunes REST API — no API key, no login, no proxy required.

### What can it do?

- **Search** tracks, music videos, podcasts, and audiobooks by any keyword
- **Trending charts** — Apple Music top 200 most-played songs for any country
- **Artist lookup** — get an artist's top songs by their Apple Music ID
- **Album lookup** — list all tracks in an album by its Apple Music ID
- **Track by ID** — fetch specific tracks directly by their Apple Music track ID

### Data Source

Uses Apple's public iTunes Search API (`itunes.apple.com/search`, `itunes.apple.com/lookup`) and the Apple Music Marketing RSS API (`rss.marketingtools.apple.com`). Both are free, unauthenticated, and accessible from any IP — no proxy required.

### Input

| Field | Type | Description |
|---|---|---|
| `mode` | select | `search`, `trending`, `artistLookup`, `albumLookup`, or `byId` |
| `searchQuery` | string | Keyword search query (required for `search` mode) |
| `mediaType` | select | `music`, `musicVideo`, `podcast`, `audiobook`, or `all` (default: `music`) |
| `country` | select | iTunes store country code — affects pricing, availability and charts (default: `us`) |
| `artistId` | integer | Apple Music artist ID (required for `artistLookup`) |
| `albumId` | integer | Apple Music album ID (required for `albumLookup`) |
| `trackIds` | array | List of Apple Music track IDs (required for `byId`) |
| `maxItems` | integer | Maximum number of records to return (1–200, default: 50) |

#### Finding Apple Music IDs

Open any track, artist, or album on [music.apple.com](https://music.apple.com) — the numeric ID is the last segment of the URL:

- Artist: `https://music.apple.com/us/artist/queen/**3296287**`
- Album: `https://music.apple.com/us/album/greatest-hits/**1440650428**`

### Output

Each record is a JSON object. Fields vary by record type (`track`, `artist`, `collection`).

#### Track fields

| Field | Description |
|---|---|
| `wrapperType` | Record type: `track`, `artist`, or `collection` |
| `kind` | Media kind: `song`, `music-video`, `podcast`, etc. |
| `trackId` | Unique Apple Music track ID |
| `artistId` | Apple Music artist ID |
| `collectionId` | Apple Music album/collection ID |
| `trackName` | Song title |
| `artistName` | Artist name |
| `collectionName` | Album name |
| `trackViewUrl` | Apple Music URL for the track |
| `artistViewUrl` | Apple Music URL for the artist |
| `collectionViewUrl` | Apple Music URL for the album |
| `artworkUrl100` | Album artwork image URL (600×600 px) |
| `previewUrl` | 30-second audio preview URL |
| `releaseDate` | ISO 8601 release date |
| `primaryGenreName` | Primary genre (e.g. `Rock`, `Hip-Hop/Rap`) |
| `trackTimeMillis` | Duration in milliseconds |
| `country` | iTunes store country |
| `currency` | Price currency (e.g. `USD`) |
| `trackPrice` | Track price |
| `discNumber` | Disc number |
| `trackNumber` | Track number on album |
| `isStreamable` | Whether the track is streamable on Apple Music |
| `contentAdvisoryRating` | `Clean` or `Explicit` |
| `scrapedAt` | ISO 8601 timestamp when the record was scraped |

#### Artist fields

`artistId`, `artistName`, `artistType`, `primaryGenreName`, `artistViewUrl`, `amgArtistId`, `scrapedAt`

#### Album/Collection fields

`collectionId`, `artistId`, `collectionName`, `artistName`, `collectionViewUrl`, `artistViewUrl`, `artworkUrl100`, `releaseDate`, `primaryGenreName`, `country`, `currency`, `collectionPrice`, `trackCount`, `contentAdvisoryRating`, `scrapedAt`

### Example Input

```json
{
  "mode": "search",
  "searchQuery": "bohemian rhapsody",
  "mediaType": "music",
  "country": "us",
  "maxItems": 10
}
````

### Example Output

```json
{
  "wrapperType": "track",
  "kind": "song",
  "trackId": 1440650711,
  "artistId": 3296287,
  "collectionId": 1440650428,
  "trackName": "Bohemian Rhapsody",
  "artistName": "Queen",
  "collectionName": "Greatest Hits I, II & III: The Platinum Collection",
  "trackViewUrl": "https://music.apple.com/us/album/bohemian-rhapsody/1440650428?i=1440650711",
  "artworkUrl100": "https://is1-ssl.mzstatic.com/image/thumb/Music116/.../600x600bb.jpg",
  "previewUrl": "https://audio-ssl.itunes.apple.com/itunes-assets/.../preview.m4a",
  "releaseDate": "1975-10-31T12:00:00Z",
  "primaryGenreName": "Rock",
  "trackTimeMillis": 355145,
  "country": "USA",
  "currency": "USD",
  "trackPrice": 1.29,
  "isStreamable": true,
  "scrapedAt": "2026-05-23T10:00:00Z"
}
```

### Frequently Asked Questions

**Does this require an API key?**
No. The iTunes Search API is completely free and public.

**How many results can I get?**
Up to 200 per run (iTunes API limit per request). Use the `maxItems` input to control it.

**Which countries are supported?**
46 countries are available in the `country` dropdown — from US, UK, Germany, Japan, Brazil and more. Affects pricing and trending charts.

**Can I get podcast data?**
Yes — set `mediaType` to `podcast` in `search` mode.

**How current are the trending charts?**
The Apple Music RSS feed is updated daily.

**Are the audio preview URLs free to use?**
Apple provides 30-second preview clips (`.m4a`). They are publicly accessible.

**What is the `artworkUrl100` field?**
The artwork image URL, automatically upscaled to 600×600 pixels (the iTunes API returns 100×100 by default).

# Actor input Schema

## `mode` (type: `string`):

What to fetch from the iTunes / Apple Music APIs.

## `searchQuery` (type: `string`):

Free-text query, e.g. 'bohemian rhapsody', 'taylor swift', 'beethoven'. Required when mode=search.

## `mediaType` (type: `string`):

Type of media to search for.

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

iTunes store country. Affects pricing, availability and charts.

## `artistId` (type: `integer`):

Numeric Apple Music artist ID, e.g. 3296287 for Queen. Find it in the artist's Apple Music URL.

## `albumId` (type: `integer`):

Numeric Apple Music album/collection ID, e.g. 1440650428 for Queen's Greatest Hits. Find it in the album's Apple Music URL.

## `trackIds` (type: `array`):

List of numeric Apple Music track IDs to look up.

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

Maximum number of records to emit.

## Actor input object example

```json
{
  "mode": "search",
  "searchQuery": "bohemian rhapsody",
  "mediaType": "music",
  "country": "us",
  "trackIds": [],
  "maxItems": 50
}
```

# Actor output Schema

## `tracks` (type: `string`):

Dataset containing all scraped iTunes / Apple Music records.

# 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 = {
    "mode": "search",
    "searchQuery": "bohemian rhapsody",
    "mediaType": "music",
    "country": "us",
    "trackIds": [],
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlergang/itunes-music-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 = {
    "mode": "search",
    "searchQuery": "bohemian rhapsody",
    "mediaType": "music",
    "country": "us",
    "trackIds": [],
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlergang/itunes-music-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 '{
  "mode": "search",
  "searchQuery": "bohemian rhapsody",
  "mediaType": "music",
  "country": "us",
  "trackIds": [],
  "maxItems": 50
}' |
apify call crawlergang/itunes-music-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "iTunes Music Scraper",
        "description": "Search 8M+ tracks on Apple iTunes with track search, trending charts, artist/album/track lookup. Free Apple REST API, no auth, no proxy required.",
        "version": "1.0",
        "x-build-id": "Lw085nzrg57mPnk6m"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crawlergang~itunes-music-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crawlergang-itunes-music-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/crawlergang~itunes-music-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crawlergang-itunes-music-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/crawlergang~itunes-music-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crawlergang-itunes-music-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",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "search",
                            "trending",
                            "artistLookup",
                            "albumLookup",
                            "byId"
                        ],
                        "type": "string",
                        "description": "What to fetch from the iTunes / Apple Music APIs.",
                        "default": "search"
                    },
                    "searchQuery": {
                        "title": "Search query (mode=search)",
                        "type": "string",
                        "description": "Free-text query, e.g. 'bohemian rhapsody', 'taylor swift', 'beethoven'. Required when mode=search."
                    },
                    "mediaType": {
                        "title": "Media type (mode=search)",
                        "enum": [
                            "music",
                            "musicVideo",
                            "podcast",
                            "audiobook",
                            "all"
                        ],
                        "type": "string",
                        "description": "Type of media to search for.",
                        "default": "music"
                    },
                    "country": {
                        "title": "Country (ISO 2-letter code)",
                        "enum": [
                            "us",
                            "gb",
                            "ca",
                            "au",
                            "de",
                            "fr",
                            "jp",
                            "br",
                            "mx",
                            "in",
                            "kr",
                            "cn",
                            "es",
                            "it",
                            "nl",
                            "se",
                            "no",
                            "dk",
                            "fi",
                            "pl",
                            "ru",
                            "tr",
                            "za",
                            "ng",
                            "ar",
                            "cl",
                            "co",
                            "pe",
                            "sg",
                            "my",
                            "id",
                            "ph",
                            "th",
                            "vn",
                            "nz",
                            "ie",
                            "pt",
                            "be",
                            "ch",
                            "at",
                            "hk",
                            "tw",
                            "sa",
                            "ae",
                            "il",
                            "eg"
                        ],
                        "type": "string",
                        "description": "iTunes store country. Affects pricing, availability and charts.",
                        "default": "us"
                    },
                    "artistId": {
                        "title": "Apple Music artist ID (mode=artistLookup)",
                        "minimum": 1,
                        "maximum": 9999999999,
                        "type": "integer",
                        "description": "Numeric Apple Music artist ID, e.g. 3296287 for Queen. Find it in the artist's Apple Music URL."
                    },
                    "albumId": {
                        "title": "Apple Music album ID (mode=albumLookup)",
                        "minimum": 1,
                        "maximum": 9999999999,
                        "type": "integer",
                        "description": "Numeric Apple Music album/collection ID, e.g. 1440650428 for Queen's Greatest Hits. Find it in the album's Apple Music URL."
                    },
                    "trackIds": {
                        "title": "Track IDs (mode=byId)",
                        "type": "array",
                        "description": "List of numeric Apple Music track IDs to look up.",
                        "default": []
                    },
                    "maxItems": {
                        "title": "Max items",
                        "minimum": 1,
                        "maximum": 200,
                        "type": "integer",
                        "description": "Maximum number of records to emit.",
                        "default": 50
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
