# YouTube Music Scraper — Plays, Monthly Audience & Charts (`yugenox/youtube-music-scraper`) Actor

Scrape YouTube Music without an account: songs with play counts, artists with monthly audience, subscribers and total views, albums with tracklists, playlists, charts for 69 countries + Global with rank and trend, new releases, lyrics and similar artists.

- **URL**: https://apify.com/yugenox/youtube-music-scraper.md
- **Developed by:** [Yugenox Corp](https://apify.com/yugenox) (community)
- **Categories:** Videos, Social media, Marketing
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.90 / 1,000 results

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/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

## YouTube Music Scraper — Plays, Monthly Audience & Charts

Scrape **YouTube Music** without an account. You get songs with **play counts**, artists with **monthly audience, subscribers and total channel views**, albums with full tracklists, playlists, **charts for 70 countries with rank and trend**, new releases, **lyrics**, **song credits** (writers, producers, label), **similar artists** and **podcasts** (popular shows and episodes by country, shows by category, weekly top podcast charts, every episode of a show). Every number comes back as the original text ("4.3B plays") and as a parsed number (4300000000), so it drops straight into a spreadsheet or dashboard.

No login, no cookies, no browser. Results start arriving in a few seconds.

### What you can scrape

| Source | What you get |
|---|---|
| **Search** (songs, videos, albums, artists, community & featured playlists, podcasts, episodes, profiles, or top results) | One row per result: title, artists, album, duration, **plays / views**, year, explicit flag, thumbnail, link. Songs searches go about 500 results deep. |
| **Artist link** | Monthly audience, subscribers, total views, description, top songs with plays, albums, singles & EPs, videos, live performances, playlists, featured-on, **similar artists** (with their monthly audience). Optionally **every song** the artist has (with plays) and the **full discography** with tracklists. |
| **Album link** | Album / single / EP, year, artists, track count, total length, **total plays**, description, and every track with plays and duration. |
| **Playlist link** | Title, author, views, track count, total length, plus one row per track. |
| **Song link** | Title, artists, album, year, duration, plays (or views and likes for music videos), track number. |
| **Charts** (70 countries + Global) | Top artists (rank, trend, subscribers), top albums (US), top 100 music videos, daily top music videos, trending, top live performances, **genre charts** (US: Jazz, Hip hop, Latin…) and **language charts** (India: Tamil, Punjabi, Telugu…) with up to 100 ranked entries each, and **weekly top podcast shows** (US, Canada, Mexico — 50 ranked shows). |
| **New releases** | The current New Releases albums and singles. |
| **Podcasts** | **Popular shows** (~180-200 per country, ranked) and **popular episodes** (200 per country, with views, publish date, length and full description), **shows by category** (Comedy, Sports, True crime, Business and 10 more), **podcast show links** (the show with its description plus its newest episodes, as many as you want) and **episode links**. Optional date filter for episodes. |
| **Extras** | Lyrics (with source), **song credits** (performed by, written by, produced by, label), related songs, similar artists — for any song. |

### Use cases

- **Music analytics & A\&R** — track play counts and monthly audience over time; the `scrapedAt` timestamp on every row makes daily snapshots easy to chart.
- **YouTube side of your streaming dashboard** — pair it with your Spotify data: plays per track, monthly audience per artist, chart positions per country.
- **Label & marketing reports** — full discography with per-track plays, total album plays, top songs.
- **Chart monitoring** — daily top music videos, trending and top artists for any of 70 countries, with up / down / same trend.
- **Playlist research** — find community and featured playlists for a genre, then pull every track.
- **Lyrics datasets** — lyrics with source attribution for a list of songs or a whole catalog.
- **Songwriter & label research** — who wrote and produced each song, and which label delivered it, for a search, an album or an artist's whole catalog (album links and discographies need `albumTracksAsRows` on, so each track is its own song row).
- **Podcast research** — the most popular shows and episodes in any country, category lists, and a show's full episode history with views, dates and lengths.

### Input examples

Songs for two artists, 100 each:

```json
{
  "searchQueries": ["taylor swift", "arijit singh"],
  "searchType": "songs",
  "maxResultsPerQuery": 100
}
```

An artist with every song and the full discography:

```json
{
  "startUrls": ["https://music.youtube.com/channel/UCPC0L1d253x-KuMNwa05TpA"],
  "artistDepth": "full"
}
```

This week's charts for the US, India and Global:

```json
{
  "chartCountries": ["US", "IN", "ZZ"],
  "chartTypes": ["topArtists", "topAlbums", "videoCharts"]
}
```

Songs from an album and a playlist, with lyrics:

```json
{
  "startUrls": [
    "https://music.youtube.com/browse/MPREb_PLKWyYmLQZS",
    "https://music.youtube.com/playlist?list=RDCLAK5uy_ndSwBc3IHsPjjjVulAco5vFZOGL-Zuy0o"
  ],
  "albumTracksAsRows": true,
  "includeLyrics": true
}
```

Songs with their credits (writers, producers, label):

```json
{
  "searchQueries": ["kendrick lamar"],
  "maxResultsPerQuery": 50,
  "includeCredits": true
}
```

Weekly top podcast shows in the US, Canada and Mexico:

```json
{
  "chartCountries": ["US", "CA", "MX"],
  "chartTypes": ["podcasts"]
}
```

Popular podcast shows and episodes in India, plus the Comedy and True crime categories:

```json
{
  "podcastLists": ["popularShows", "popularEpisodes", "categories"],
  "podcastCountries": ["IN"],
  "podcastCategories": ["Comedy", "True crime"]
}
```

A podcast with its last 200 episodes, only those from the last 90 days:

```json
{
  "startUrls": ["https://music.youtube.com/browse/MPSPPLzJVLNWKVr6ksDjycE7NpSptOlcaEP-jQ"],
  "maxEpisodesPerShow": 200,
  "newerThan": "90 days"
}
```

#### Main input fields

| Field | What it does |
|---|---|
| `searchQueries` | Terms to search. Each runs its own search. |
| `searchType` | `songs` (default), `videos`, `albums`, `artists`, `community_playlists`, `featured_playlists`, `podcasts`, `episodes`, `profiles`, or `all` (top results). |
| `maxResultsPerQuery` | Results per search term (default 50). |
| `startUrls` | Artist, album, playlist, song, podcast show (`/browse/MPSP…`) or episode (`/browse/MPED…`) links (music.youtube.com, youtube.com, youtu.be, or bare IDs). |
| `artistDepth` | `summary`, `allSongs`, `discography` or `full`. |
| `chartCountries` / `chartTypes` | Countries and chart sections to scrape (`topArtists`, `topAlbums`, `videoCharts`, `genreCharts`, `podcasts`). |
| `expandChartPlaylists` | Save every ranked chart entry (default on) or one row per chart. |
| `includeNewReleases` | Add the New Releases page. |
| `podcastLists` | `popularShows`, `popularEpisodes`, `categories`. |
| `podcastCountries` / `podcastCategories` | Countries for the podcast lists (default: `country`) and which categories (default: all). |
| `podcastDepth` | For podcast shows found in lists, charts or searches: `summary` (as listed), `details` (adds the show's description) or `episodes` (details + each show's newest episodes as rows). |
| `maxEpisodesPerShow` | Newest episodes per show (default 20; 0 = the show row only). |
| `newerThan` | Only podcast episodes published on or after this day (`2026-09-01`, `7 days`). |
| `fetchDetails` | Open every album, artist and playlist found and add its full details. |
| `includeLyrics` / `includeRelated` | Lyrics / related songs and similar artists for every song. |
| `includeCredits` | Song credits for every audio song row: performers, writers, producers, label. Album tracks get them with `albumTracksAsRows` on. |
| `albumTracksAsRows` | Also save each album track as its own row. |
| `country` / `language` | Localize results (`US`, `IN`, …; `en`, `es`, …). |
| `maxItems` | Cap for the whole run. |

### Output

Every row has a `type` (`song`, `video`, `artist`, `album`, `playlist`, `podcast`, `episode`, `profile`), a `url`, a `thumbnail`, the `source` it came from and `scrapedAt`. Numbers are always given twice: the text as shown (`playsText`, `monthlyAudienceText`, `subscribersText`) and parsed (`plays`, `monthlyAudience`, `subscribers`).

A song from a search:

```json
{
  "type": "song",
  "title": "Shake It Off",
  "videoId": "1nFxMuPYeKA",
  "url": "https://music.youtube.com/watch?v=1nFxMuPYeKA",
  "artists": [{ "name": "Taylor Swift", "channelId": "UCPC0L1d253x-KuMNwa05TpA" }],
  "artist": "Taylor Swift",
  "album": { "title": "1989", "browseId": "MPREb_K9GL6DCDUCq" },
  "duration": "3:40",
  "durationSeconds": 220,
  "playsText": "4.3B plays",
  "plays": 4300000000,
  "isExplicit": false,
  "videoType": "audio",
  "thumbnail": "https://yt3.googleusercontent.com/…=w544-h544-l90-rj",
  "position": 1,
  "query": "taylor swift",
  "source": { "type": "search", "input": "taylor swift", "searchType": "songs" },
  "scrapedAt": "2026-09-24T08:38:40.170Z"
}
```

An artist (lists shortened):

```json
{
  "type": "artist",
  "name": "Taylor Swift",
  "channelId": "UCPC0L1d253x-KuMNwa05TpA",
  "url": "https://music.youtube.com/channel/UCPC0L1d253x-KuMNwa05TpA",
  "monthlyAudienceText": "445M monthly audience",
  "monthlyAudience": 445000000,
  "subscribersText": "63.4M subscribers",
  "subscribers": 63400000,
  "totalViewsText": "46,439,995,925 views",
  "totalViews": 46439995925,
  "topSongs": [{ "title": "The Fate of Ophelia", "videoId": "7nVctvQVz0U", "playsText": "800M plays", "plays": 800000000 }],
  "albums": [{ "title": "The Life of a Showgirl", "browseId": "MPREb_p6BGcsuOpGt", "year": 2025 }],
  "singles": ["…"],
  "videos": ["…"],
  "similarArtists": [{ "name": "Julia Michaels", "monthlyAudience": 5040000 }],
  "allSongsPlaylistId": "OLAK5uy_kRl6HdICkQpZF7zuHu_Yx-RDVHw-hboxo"
}
```

A chart entry:

```json
{
  "type": "artist",
  "name": "Alka Yagnik",
  "subscribersText": "2.26M subscribers",
  "subscribers": 2260000,
  "rank": 1,
  "trend": "same",
  "chartCountry": "ZZ",
  "chartCountryName": "Global",
  "chartType": "topArtists",
  "chartName": "Top artists"
}
```

A song with credits (`includeCredits`):

```json
{
  "type": "song",
  "title": "Not Like Us",
  "artist": "Kendrick Lamar",
  "credits": {
    "performers": ["Kendrick Lamar"],
    "writers": ["Kendrick Lamar", "Sean Momberger", "…"],
    "producers": ["Mustard"],
    "other": []
  },
  "label": "Kendrick Lamar, under exclusive license to Interscope Records"
}
```

A podcast show from the popular list (`podcastDepth: "details"` adds the description):

```json
{
  "type": "podcast",
  "title": "Financial Audit",
  "showId": "MPSPPLzJVLNWKVr6ksDjycE7NpSptOlcaEP-jQ",
  "playlistId": "PLzJVLNWKVr6ksDjycE7NpSptOlcaEP-jQ",
  "url": "https://music.youtube.com/browse/MPSPPLzJVLNWKVr6ksDjycE7NpSptOlcaEP-jQ",
  "youtubeUrl": "https://www.youtube.com/playlist?list=PLzJVLNWKVr6ksDjycE7NpSptOlcaEP-jQ",
  "author": { "name": "Caleb Hammer", "channelId": "UCLe_q9axMaeTbjN0hy1Z9xA" },
  "channelId": "UCLe_q9axMaeTbjN0hy1Z9xA",
  "description": "…",
  "rank": 1,
  "country": "US",
  "category": null
}
```

A podcast episode:

```json
{
  "type": "episode",
  "title": "The Most UNHINGED Woman In Financial Audit History",
  "videoId": "QhrjI7-Y788",
  "url": "https://music.youtube.com/watch?v=QhrjI7-Y788",
  "youtubeUrl": "https://www.youtube.com/watch?v=QhrjI7-Y788",
  "show": { "title": "Financial Audit", "showId": "MPSPPLzJVLNWKVr6ksDjycE7NpSptOlcaEP-jQ", "url": "https://music.youtube.com/browse/MPSPPLzJVLNWKVr6ksDjycE7NpSptOlcaEP-jQ" },
  "viewsText": "674K views",
  "views": 674000,
  "publishedText": "10h ago",
  "publishedDate": "2026-10-09",
  "duration": "1 hr 33 min",
  "durationSeconds": 5580,
  "description": "…",
  "position": 1
}
```

The dataset has ready-made table views: **Overview**, **Songs & plays**, **Artists**, **Charts**, **Podcasts** and **Song credits**. Export to JSON, CSV, Excel or connect it to Google Sheets, Make, Zapier or your own API client.

### Reliability

- **Runs never fail on data problems.** A bad link, an artist that does not exist, a blocked request or a
  YouTube Music hiccup is reported in the run's status message; everything else is still delivered.
  Results are written as they come in, so a run that hits its time limit or your spending limit ends
  with the rows collected so far and a `Partial — …` / `Stopped at …` message.
- **You pay only for delivered rows.** Rows are billed in the same step that writes them to the dataset
  (`result` per row, `lyrics` only for rows where lyrics were found); error rows are never billed. Song
  credits, podcast details and episodes skipped by your date filter add no charge of their own.
- **Blocked requests retry on fresh IPs** with backoff, move to residential proxies automatically, and a
  run-wide block stops the run early with what was collected instead of burning your budget.
- **Forgiving input.** Common aliases are accepted (`queries`, `limit`, `maxResults`, `hl`/`gl`, `lyrics`, `urls`…),
  a single string works where a list is expected (one entry per line), `searchType` can be a list
  (`["songs", "albums"]` runs both), and invalid values are skipped with a warning instead of a failed run.
- A `RUN_REPORT` record in the run's key-value store summarizes requests, retries, failures and drift checks.

### FAQ

**Do I need a YouTube or Google account?** No. Nothing to log in to and no cookies to supply.

**How fast is it?** About 20 songs per request and 100 tracks per playlist page. A 100-song search takes a few seconds; the full US charts (about 900 ranked entries) take under 10 seconds.

**How deep does search go?** Songs searches return about 500 unique results per term. Duplicates across pages are removed and only unique rows count toward your limit.

**Why is `plays` empty on some rows?** YouTube Music shows play counts on songs in search results, albums, artist song lists and artist pages. Chart lists and some curated playlists show no count; the row still has everything else. Very new or very small artists also have no monthly audience figure.

**What's the difference between plays and views?** Audio tracks show "plays", music videos show "views". Both land in `plays` (with the original text in `playsText`) so you can sort by one column; `videoType` tells you which kind the row is.

**Can I get time-series data?** Schedule the actor (daily or weekly) with the same input — each run's rows carry `scrapedAt`, so you can chart plays, monthly audience and chart rank over time.

**Which countries have charts?** Global plus 69 countries (Argentina to Zimbabwe). Top artists and music-video charts exist everywhere. Top albums are US-only. The weekly top podcast shows chart (50 shows) exists for the US, Canada and Mexico. Genre charts are US-only (choose `genreCharts`) and language charts India-only (same option).

**Can I scrape YouTube Music podcasts?** Yes. Pick `podcastLists` for the popular shows and episodes of any country or the category lists, add the weekly top podcast chart with `chartTypes: ["podcasts"]`, search with `searchType` = `podcasts` or `episodes`, or paste podcast show links (`music.youtube.com/browse/MPSP…`) to get a show with its newest episodes (`maxEpisodesPerShow`, as many as the show has). Episodes from the popular lists, show links and episode links come with views, publish date, length and description. Episodes found by search come as listed (title, show, date in `dateText`) unless you set `podcastDepth` to `details` or `episodes`, which opens each one. Popular lists follow the country; category lists are the same everywhere.

**How exact are podcast publish dates?** YouTube Music shows recent episodes as "10h ago" or "3d ago" and older ones as "Sep 14" or "Dec 1, 2025". `publishedText` is that text; `publishedDate` turns it into a day (YYYY-MM-DD), accurate to about a day for recent episodes.

**Where do song credits come from?** From YouTube Music's own "View song credits" panel: performed by, written by, produced by, and "Music metadata provided by" (the label or distributor) as `label`. Most official audio tracks have them; music videos and user uploads do not (`credits` is then `null`).

**Can I download audio?** No. This actor collects public catalog data and statistics only.

**Is it legal to scrape YouTube Music?** This actor collects only publicly available data — the same catalog pages, play counts and charts anyone can see on music.youtube.com without signing in. Some rows can contain people's names: artist names, songwriter and producer credits, and the public channel names of profiles, playlist creators and podcast hosts. Personal data is protected by laws such as GDPR (EU), PIPEDA (Canada) and CCPA (California), so only collect it when you have a legitimate reason, and follow YouTube's terms for how you use the data. Lyrics are copyrighted by their songwriters and publishers: fine for analysis, but get a license before you republish them. If you're unsure whether your use case is legitimate, check with a lawyer. Background reading: [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/)

**Does it access any private data?** No. It never signs in and uses no account, cookies or tokens, so it only sees what YouTube Music shows to a visitor who is not logged in. Private playlists, listening history, likes, library, uploads and any account data are out of reach — a private or deleted link is skipped, reported in the run's status message and never charged. No audio or video is downloaded.

**Something missing or wrong?** Open an issue on the actor page and include your input.

# Actor input Schema

## `searchQueries` (type: `array`):

Search YouTube Music, one term per line — an artist, song, album, genre or mood. Each term runs its own search.

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

Which YouTube Music results tab to scrape for every search term. "Top results" is the mixed first page (top result + a few of each type).

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

How many results to collect for each search term (20 per page, duplicates removed). Songs searches go about 500 deep.

## `startUrls` (type: `array`):

Artist (music.youtube.com/channel/UC…), album (/browse/MPREb\_…), playlist (/playlist?list=…), song (/watch?v=…), podcast show (/browse/MPSP…) and podcast episode (/browse/MPED…) links. youtube.com / youtu.be song links and bare IDs work too.

## `artistDepth` (type: `string`):

For artist links. Summary: one row with monthly audience, subscribers, total views, top songs, albums, singles, videos and similar artists. All songs: also one row per song in the artist's full song list, with play counts. Discography: also one row per album / single / EP with its full tracklist. Everything: both.

## `albumTracksAsRows` (type: `boolean`):

Albums always include their tracklist (tracks with plays and duration). Turn this on to also save every album track as its own song row.

## `chartCountries` (type: `array`):

Scrape the YouTube Music charts for these countries (Global included). Leave empty to skip charts.

## `chartTypes` (type: `array`):

Which chart sections to save. Not every country has every section: top artists and the music-video charts exist everywhere; top albums are US-only; weekly top podcast shows (50 ranked shows) exist for the US, Canada and Mexico; genre charts (Jazz, Hip hop…) for the US and language charts (Tamil, Punjabi…) for India.

## `expandChartPlaylists` (type: `boolean`):

Save every ranked entry of the music-video, trending and genre charts (up to 100 each, with rank and trend). Off: one row per chart instead.

## `includeNewReleases` (type: `boolean`):

Also save the current New Releases albums and singles.

## `podcastLists` (type: `array`):

YouTube Music podcast lists to save, for every country in "Podcast countries". Popular shows: the ~180-200 most popular shows, ranked. Popular episodes: the 200 most popular episodes with views, publish date, length and description. Shows by category: Comedy, Sports, True crime and 11 more (24 shows each). Leave empty to skip podcasts.

## `podcastCountries` (type: `array`):

Countries for the podcast lists (popular shows and episodes differ by country). Leave empty to use "Country" below (US by default). Category lists are the same in every country today, so one country is enough for them.

## `podcastCategories` (type: `array`):

For "Shows by category": which categories to save. Leave empty for all of them.

## `podcastDepth` (type: `string`):

For podcast shows found in podcast lists, the podcast chart or a podcast search. Summary: the row as listed. Details: also open each show and add its description (one extra request per show; episodes found by search get views, length and description). Latest episodes: details plus one row per episode, the newest of each show up to "Episodes per show".

## `maxEpisodesPerShow` (type: `integer`):

How many of a show's newest episodes to save: for podcast show links, and for listed shows when Podcast depth is "Latest episodes". 20 come with the show page, then 100 per extra page. 0 = the show row only.

## `newerThan` (type: `string`):

Only save podcast episodes published on or after this day: a date (2026-09-01) or an age (7 days, 2 weeks, today). Older episodes are skipped and never charged. YouTube Music shows recent dates as "3d ago", so the date is accurate to about a day.

## `fetchDetails` (type: `boolean`):

For albums, artists and playlists found by search, charts or new releases: open each one and add its full details (album tracklists with plays, artist stats and top songs, playlist tracks). One extra request per result.

## `includeLyrics` (type: `boolean`):

Add full lyrics (and their source) to every song and music video. Two extra requests per song.

## `includeRelated` (type: `boolean`):

Add up to 20 related songs and 20 similar artists to every song and music video.

## `includeCredits` (type: `boolean`):

Add the song credits YouTube Music shows to every audio song: performers, writers, producers and the label ("Music metadata provided by"). One small extra request per song; music videos and user uploads have no credits. Credits go on song rows only: for album links and discographies turn on "Album tracks as rows" to get them for each track.

## `language` (type: `string`):

Interface language code (en, es, hi, de…). Play counts and audience numbers are parsed from English text, so keep "en" for analytics.

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

Two-letter country code used to localize search results (US, IN, GB, BR…). Charts use "Chart countries" above.

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

Stop after this many rows in total. Leave empty for no limit.

## `maxConcurrency` (type: `integer`):

How many requests run at once.

## `proxyConfiguration` (type: `object`):

Apify datacenter proxy works well; requests that get blocked are retried on residential proxies automatically.

## Actor input object example

```json
{
  "searchQueries": [
    "taylor swift"
  ],
  "searchType": "songs",
  "maxResultsPerQuery": 20,
  "artistDepth": "summary",
  "albumTracksAsRows": false,
  "chartTypes": [
    "topArtists",
    "topAlbums",
    "videoCharts"
  ],
  "expandChartPlaylists": true,
  "includeNewReleases": false,
  "podcastDepth": "summary",
  "maxEpisodesPerShow": 20,
  "fetchDetails": false,
  "includeLyrics": false,
  "includeRelated": false,
  "includeCredits": false,
  "language": "en",
  "country": "US",
  "maxConcurrency": 10,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

All scraped rows.

## `run` (type: `string`):

Status and statistics for 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 = {
    "searchQueries": [
        "taylor swift"
    ],
    "maxResultsPerQuery": 20,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("yugenox/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 = {
    "searchQueries": ["taylor swift"],
    "maxResultsPerQuery": 20,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("yugenox/youtube-music-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 '{
  "searchQueries": [
    "taylor swift"
  ],
  "maxResultsPerQuery": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call yugenox/youtube-music-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,yugenox/youtube-music-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/7Eyd5KuMdgzhOF1Hn/builds/bCii9DMsSbJe8MA6z/openapi.json
