# YouTube Playlist Scraper (`scrapemamba/youtube-playlist-scraper`) Actor

Scrape YouTube playlist videos into Dataset rows: IDs, titles, positions, views, durations, thumbnails, and playlist metadata. Cap results per playlist — metadata only, not a downloader.

- **URL**: https://apify.com/scrapemamba/youtube-playlist-scraper.md
- **Developed by:** [Scrape Mamba](https://apify.com/scrapemamba) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.39 / 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?

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

## YouTube Playlist Scraper — Playlist Videos & Metadata

Scrape YouTube playlists into Dataset rows: playlist metadata plus ordered videos with **position**, IDs, titles, views, durations, and thumbnails. Ideal for courses, albums, and editorial collections — metadata only, not a video downloader.

**[Run YouTube Playlist Scraper on Apify](https://apify.com/scrapemamba/youtube-playlist-scraper)** · Built by **ScrapeMamba** · Metadata only, not a video downloader

***

### Why this Actor?

Playlists are durable join keys for curricula, music catalogs, and curated series. This Actor accepts playlist URLs or IDs, fetches capped video lists with positions preserved, and writes both a playlist meta row and per-video rows — ready for warehouse loads and enrichment.

- Accepts `?list=` URLs or bare playlist IDs
- Preserves video `position` for ordered catalogs
- Cap videos per playlist with `maxResults` (default `100`)
- Optional `lang` / `country` for locale

***

### Key features

- Playlist meta + ordered video rows in one run
- Deduped playlist IDs before fetch
- Per-playlist error isolation
- Stable `playlistId` + `videoId` + `position` join keys
- Apify Console, schedules, and API support

***

### What you can scrape

#### Playlist meta (`type: "playlist"`)

`playlistId`, `playlistTitle`, `playlistUrl`, `playlistDescription`, `playlistThumbnail`, `playlistVideoCount`, `playlistVisibility`, `playlistChannelId`, `playlistChannelName`, `playlistChannelUrl`

#### Playlist videos (`type: "playlist_video"`)

`videoId`, `title`, `author`, `channelId`, `views`, `likes`, `duration` / `length`, `position`, `thumbnail`, `url`, `isLive`, `deleted`, plus playlist fields for denormalized joins

***

### Use cases

- **Course / curriculum export** — Ordered lesson lists with positions
- **Music / album catalogs** — Tracklists with duration and channel metadata
- **Editorial collections** — Archive curated series for analysis
- **Dataset building** — `playlistId` ↔ `videoId` fact tables
- **Enrichment pipelines** — Hand video IDs to Video or Subtitles scrapers

***

### Example output

**Playlist meta**

```json
{
  "type": "playlist",
  "playlistId": "PLOzDu-MXXLljymo0oXEkTSLKf5TqxY-JN",
  "playlistTitle": "Example course playlist",
  "playlistUrl": "https://www.youtube.com/playlist?list=PLOzDu-MXXLljymo0oXEkTSLKf5TqxY-JN",
  "playlistVideoCount": 42,
  "playlistChannelName": "Example Channel",
  "playlistChannelId": "UCxxxxxxxxxxxxxxxxxxxxxx"
}
```

**Video row**

```json
{
  "type": "playlist_video",
  "playlistId": "PLOzDu-MXXLljymo0oXEkTSLKf5TqxY-JN",
  "playlistTitle": "Example course playlist",
  "position": 1,
  "videoId": "abc123xyz01",
  "title": "Lesson 1",
  "author": "Example Channel",
  "views": 120000,
  "duration": 612,
  "url": "https://www.youtube.com/watch?v=abc123xyz01"
}
```

***

### How to use

1. Open **[YouTube Playlist Scraper](https://apify.com/scrapemamba/youtube-playlist-scraper)**
2. Add `playlists` and set `maxResults`
3. Run → filter by `type` (`playlist` vs `playlist_video`)

#### Input example

```json
{
  "playlists": [
    "https://www.youtube.com/playlist?list=PLOzDu-MXXLljymo0oXEkTSLKf5TqxY-JN"
  ],
  "maxResults": "50",
  "lang": "en",
  "country": "us"
}
```

#### API (Node.js)

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('scrapemamba/youtube-playlist-scraper').call({
  playlists: ['PLOzDu-MXXLljymo0oXEkTSLKf5TqxY-JN'],
  maxResults: '100',
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

#### Local run

```bash
cd youtube-playlist-scraper-js
cp .env.example .env
npm install
node src/main.js
```

***

### Input parameters

| Parameter | Required | Default | Description |
|---|---|---|---|
| `playlists` | Yes | — | Playlist URLs or IDs |
| `maxResults` | No | `"100"` | Max videos **per playlist**. Free users capped at **200**; paying users uncapped. |
| `lang` | No | — | YouTube `hl` (e.g. `en`) |
| `country` | No | — | YouTube `gl` (e.g. `us`) |

***

### Output

Each successful playlist yields one `type: "playlist"` meta row and up to `maxResults` `type: "playlist_video"` rows. Failures are `type: "error"` without stopping sibling playlists.

***

### Why choose this Actor

- **Position preserved** — Ordered catalogs for courses and albums
- **Meta + videos together** — One run covers playlist and entries
- **Cap-friendly** — Control cost before enriching every ID
- **Public / unlisted ready** — Works with public and unlisted playlists you can open without owner login (not private)

***

### Pricing

**$0.39 per 1,000 results** on Apify (meta + video rows count). Free users: `maxResults` capped at **200** per playlist. See the [Store page](https://apify.com/scrapemamba/youtube-playlist-scraper).

***

### FAQ

#### Does it download playlist videos?

No. Metadata and links only.

#### Private playlists?

Not supported — owner login would be required. Public and unlisted playlists that open without login work.

#### Default `maxResults`?

`"100"`. Free users capped at **200**; paying users uncapped.

#### How do I enrich videos afterward?

Collect `videoId`s from `playlist_video` rows and run Video Scraper or Subtitles Scraper.

***

### Related Actors

| Actor | Use it for |
|---|---|
| [YouTube Video Scraper](https://apify.com/scrapemamba/youtube-video-scraper) | Per-video details |
| [YouTube Subtitles Scraper](https://apify.com/scrapemamba/youtube-subtitles-scraper) | Course transcripts |
| [YouTube Search Scraper](https://apify.com/scrapemamba/youtube-search-scraper) | Discover related keywords first |

Use only on **public** (or unlisted-accessible) playlist data per YouTube’s terms and applicable law.

# Actor input Schema

## `playlists` (type: `array`):

Playlist URLs or IDs (e.g. https://www.youtube.com/playlist?list=PLxxxxx).

## `maxResults` (type: `string`):

Maximum videos per playlist. Free users are capped at 200.

## `lang` (type: `string`):

Optional YouTube UI language (e.g. en).

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

Optional country / region code (e.g. us).

## Actor input object example

```json
{
  "playlists": [
    "https://www.youtube.com/playlist?list=PLOzDu-MXXLljymo0oXEkTSLKf5TqxY-JN"
  ],
  "maxResults": "100",
  "lang": "en",
  "country": "us"
}
```

# Actor output Schema

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

Default dataset items produced by this Actor.

# 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 = {
    "playlists": [
        "https://www.youtube.com/playlist?list=PLOzDu-MXXLljymo0oXEkTSLKf5TqxY-JN"
    ],
    "maxResults": "100",
    "lang": "en",
    "country": "us"
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapemamba/youtube-playlist-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 = {
    "playlists": ["https://www.youtube.com/playlist?list=PLOzDu-MXXLljymo0oXEkTSLKf5TqxY-JN"],
    "maxResults": "100",
    "lang": "en",
    "country": "us",
}

# Run the Actor and wait for it to finish
run = client.actor("scrapemamba/youtube-playlist-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 '{
  "playlists": [
    "https://www.youtube.com/playlist?list=PLOzDu-MXXLljymo0oXEkTSLKf5TqxY-JN"
  ],
  "maxResults": "100",
  "lang": "en",
  "country": "us"
}' |
apify call scrapemamba/youtube-playlist-scraper --silent --output-dataset

```

## MCP server setup

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