# YouTube Music Scraper (`maximedupre/youtube-music-scraper`) Actor

Scrape public YouTube Music searches and known URLs. Export songs, videos, albums, artists, playlists, podcasts, and profiles with source IDs, creators, metrics, thumbnails, and URLs.

- **URL**: https://apify.com/maximedupre/youtube-music-scraper.md
- **Developed by:** [Maxime Dupré](https://apify.com/maximedupre) (community)
- **Categories:** Social media
- **Stats:** 4 total users, 0 monthly users, 96.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.65 / 1,000 music entities

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

### 🎵 Turn YouTube Music pages into useful data

YouTube Music Scraper is for music researchers, marketers, creators, and developers. It searches public YouTube Music and reads known URLs. You get songs, videos, albums, artists, playlists, podcasts, and profiles with source IDs, creators, counts, thumbnails, and URLs.

Use it to:

- **[YouTube Music Song Scraper](https://apify.com/maximedupre/youtube-music-scraper/examples/youtube-music-song-scraper)** — find songs by keyword and collect artist, album, duration, play count, and source data when shown.
- **[YouTube Music Video Scraper](https://apify.com/maximedupre/youtube-music-scraper/examples/youtube-music-video-scraper)** — find music videos and collect titles, channels, views, durations, thumbnails, and URLs.
- **[YouTube Music Album Scraper](https://apify.com/maximedupre/youtube-music-scraper/examples/youtube-music-album-scraper)** — find albums and collect titles, artists, dates, song counts, IDs, and links when shown.
- **[YouTube Music Artist Scraper](https://apify.com/maximedupre/youtube-music-scraper/examples/youtube-music-artist-scraper)** — find artists and collect names, channel IDs, subscriber counts, thumbnails, and profile links.
- **[YouTube Music Playlist Scraper](https://apify.com/maximedupre/youtube-music-scraper/examples/youtube-music-playlist-scraper)** — find playlists and collect titles, creators, song counts, IDs, thumbnails, and URLs.
- **[YouTube Music Podcast Scraper](https://apify.com/maximedupre/youtube-music-scraper/examples/youtube-music-podcast-scraper)** — find podcasts and collect titles, creators, song counts, IDs, thumbnails, and links when shown.
- **[YouTube Music Profile Scraper](https://apify.com/maximedupre/youtube-music-scraper/examples/youtube-music-profile-scraper)** — find profiles and collect names, handles, channel IDs, thumbnails, and source links.

The Actor can search by keyword and enrich known public URLs in the same run. It does not download or save audio or video files.

#### 📦 Data you get

Each saved row is one public YouTube Music entity. Fields include:

- `matchedInput`, `contentType`, `sourcePosition`, `title`, and `url`
- `ids` for available video, playlist, browse, channel, and profile IDs
- `creators` with names, channel IDs, and links when shown
- `album` and `playlist` context when found
- `durationSeconds` and `releaseDate`
- `metrics` for available plays, views, likes, subscribers, and songs
- `thumbnails` with image width and height when shown
- `description`, `tags`, `mediaFormats`, and `heatmap` when available

YouTube Music does not show every field for every content type. Missing values stay `null` or use an empty array. Direct track and video URLs may include media format details and audience-interest heatmap points. Playable media URLs are not promised.

#### 🚀 Run the Actor

1. Add one or more search terms, public YouTube Music URLs, or both.
2. Pick the content type for keyword searches.
3. Set the most results to collect for each query.
4. Start the run and open the dataset.
5. Export the rows or read them through the Apify API.

The Actor can keep successful rows when another submitted search or URL is invalid or unavailable. Repeated entities are saved once within a run.

#### 🛠️ Input

| Field | Required | What to enter |
| --- | --- | --- |
| `keywords` | No | Search terms for genres, artists, moods, or topics. Add at least one keyword or URL. |
| `youtubeMusicUrls` | No | Public YouTube Music watch, album, or playlist URLs. |
| `searchType` | No | `songs`, `videos`, `albums`, `artists`, `playlists`, `podcasts`, or `profiles`. The default is `songs`. |
| `maxResultsPerQuery` | No | Results to collect for each query, from 1 to 10,000. The default is 750. |

```json
{
  "keywords": ["jazz", "lofi beats"],
  "youtubeMusicUrls": [
    { "url": "https://music.youtube.com/watch?v=BXmEJL1mnuU" }
  ],
  "searchType": "songs",
  "maxResultsPerQuery": 25
}
```

Search settings apply only to keyword searches. A run may include up to 100 keywords and 1,000 submitted URLs.

#### 📄 Output

A saved song row can look like this:

```json
{
  "matchedInput": "jazz",
  "contentType": "song",
  "sourcePosition": 1,
  "title": "Autumn Leaves",
  "url": "https://music.youtube.com/watch?v=zTVlrOk9a8M",
  "ids": {
    "videoId": "zTVlrOk9a8M",
    "playlistId": null,
    "browseId": null,
    "channelId": null,
    "profileHandle": null
  },
  "creators": [
    { "name": "Chet Baker", "channelId": null, "url": null }
  ],
  "album": {
    "title": "This Is Jazz #2",
    "playlistId": null,
    "browseId": null,
    "url": null
  },
  "playlist": null,
  "durationSeconds": 423,
  "releaseDate": null,
  "metrics": {
    "playCount": 31000000,
    "viewCount": null,
    "likeCount": null,
    "subscriberCount": null,
    "songCount": null
  },
  "thumbnails": [],
  "description": null,
  "tags": [],
  "mediaFormats": [],
  "heatmap": []
}
```

You can export the dataset as JSON, CSV, Excel, XML, or RSS.

#### 💰 Pricing

This Actor uses pay-per-event pricing. You pay for each public music entity saved to the dataset. Empty searches, unsupported URLs, skipped inputs, and diagnostic messages do not create charged rows.

#### 🔌 Integrations

Use Apify datasets, the API, schedules, and webhooks to send the output to your own workflow. This video shows how to use Apify integrations:

https://www.youtube.com/watch?v=bNACk1\_S\_6w\&list=PLObrtcm1Kw6MUrlLNDbK9QRg8VDJg0gOW\&index=4

#### ⚠️ Limits

The Actor reads public data only. It does not access private, protected, removed, age-gated, or unavailable content. It does not expand an album or playlist into every track. Source fields may vary by content type.

#### ❓ FAQ

**Can I enrich a full album or playlist track list?**

No. A submitted album or playlist URL returns one row for that album or playlist. It does not return every track inside it.

**Why are some counts or IDs missing?**

YouTube Music does not show every fact for every entity. The Actor uses `null` or an empty array instead of guessing.

**Can I use a YouTube Music URL and search terms together?**

Yes. Add both to one run. Search settings apply to the keywords, while known URLs are read on their own.

**Do I need a YouTube API key, cookies, or login?**

No. The Actor reads public YouTube Music data and does not ask for source credentials.

**Is this a YouTube Music downloader?**

No. It exports metadata. It does not download, convert, or save audio or video files.

**How is this different from YouTube Music scraper libraries?**

You do not need to install or maintain a library. Run the Actor in Apify, then read the dataset through exports or the API. Source changes can still affect which public fields are available.

### 📝 Changelog

- 0.1: Initial release.

### 🆘 Support

For issues, questions, or feature requests, [file a ticket](https://console.apify.com/actors/maximedupre~youtube-music-scraper/issues) and I'll fix or implement it in less than 24h 🫡

### 🔗 Related Actors

- [YouTube Music Downloader](https://apify.com/maximedupre/youtube-music-downloader) — save audio files from direct public YouTube Music and YouTube links.
- [YouTube Channel Search Scraper](https://apify.com/maximedupre/youtube-channel-search-scraper) — find public YouTube channels from keywords or search URLs.
- [YouTube Trending Videos Scraper](https://apify.com/maximedupre/youtube-trending-videos-scraper) — collect ranked videos from YouTube category pages and Music charts.
- [YouTube Tags Extractor](https://apify.com/maximedupre/youtube-tags-extractor) — get hidden tags and metadata from known public YouTube videos.
- [SoundCloud Scraper](https://apify.com/maximedupre/soundcloud-scraper) — research public tracks, artists, playlists, albums, and comments on another music source.

**Made with ❤️ by Maxime Dupré**

# Actor input Schema

## `keywords` (type: `array`):

Find YouTube Music results for genres, artists, moods, topics, or other keywords.

## `youtubeMusicUrls` (type: `array`):

Get details for known YouTube Music tracks, videos, albums, or playlists.

## `searchType` (type: `string`):

Choose the type of YouTube Music result to collect for each search query.

## `maxResultsPerQuery` (type: `integer`):

Set the most search results to collect for each query. This limit does not apply to submitted URLs.

## Actor input object example

```json
{
  "keywords": [
    "Taylor Swift"
  ],
  "youtubeMusicUrls": [],
  "searchType": "songs",
  "maxResultsPerQuery": 750
}
```

# Actor output Schema

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

Open the dataset to view the public music entities saved by this run.

# 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 = {
    "keywords": [
        "Taylor Swift"
    ],
    "youtubeMusicUrls": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("maximedupre/youtube-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 = {
    "keywords": ["Taylor Swift"],
    "youtubeMusicUrls": [],
}

# Run the Actor and wait for it to finish
run = client.actor("maximedupre/youtube-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 '{
  "keywords": [
    "Taylor Swift"
  ],
  "youtubeMusicUrls": []
}' |
apify call maximedupre/youtube-music-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/u80On213YHFeL1onD/builds/QXoN869XXRsCheGLp/openapi.json
