# YouTube Playlist Videos Scraper (`receptional_blender/youtube-playlist-extractor`) Actor

Extract every video from a YouTube playlist in one run — title, id, watch URL, position, duration, view count, channel, publish time and thumbnail. Reads YouTube’s InnerTube API directly and pages the whole playlist automatically. No Data API key, no headless browser.

- **URL**: https://apify.com/receptional\_blender/youtube-playlist-extractor.md
- **Developed by:** [Assia Fadli](https://apify.com/receptional_blender) (community)
- **Categories:** Videos
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 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/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

## YouTube Playlist Videos Scraper

**YouTube Playlist Videos Scraper** turns any YouTube playlist into a clean, structured list of its
videos. Paste a playlist URL — or a bare playlist id — and get one tidy row per video, in playlist
order, ready to drop into a spreadsheet, database or downstream pipeline.

No YouTube Data API key. No headless browser. No login. It talks straight to YouTube's own
**InnerTube** API (the same endpoints the website uses) and pages through the entire playlist
automatically, so it's fast, cheap and reliable.

Built for creators, analysts, agencies and developers who need a dependable playlist export without
maintaining scraping infrastructure.

### What you get

One dataset row per video:

| Field | Description |
| --- | --- |
| `playlistId` | The playlist id (e.g. `PL...`, `UU...`) |
| `playlistTitle` | The playlist's display name |
| `videoId` | 11-character video id |
| `title` | Video title |
| `url` | `https://www.youtube.com/watch?v=<videoId>` |
| `index` | Position of the video in the playlist (1-based) |
| `duration` | Length, e.g. `"16:09"` |
| `lengthSeconds` | Length in seconds (when available) |
| `views` | View count text, e.g. `"7.4M views"` |
| `channelName` | Uploader / channel name |
| `channelId` | The uploader's `UC...` id (when available) |
| `published` | Relative publish time, e.g. `"5 years ago"` |
| `thumbnail` | Highest-resolution thumbnail URL |

If the playlist can't be read (empty, private, unavailable or an invalid id), the actor still writes
a row — `{ "playlistId": "...", "error": "..." }` — instead of finishing with empty output.

### Input

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `playlistUrl` | string | ✅ | `https://www.youtube.com/playlist?list=PLbpi6ZahtOH6Blw3RGYpWkSByi_T7Rygb` | Playlist URL, a watch URL with a `list=` param, or a bare playlist id (`PL...`, `UU...`, `OL...`) |
| `maxResults` | integer | — | `100` | Maximum number of videos to return (fetched in playlist order) |
| `proxyCountryCode` | string | — | `US` | ISO country code for the Apify residential proxy; leave blank to let Apify choose |

You can also pass the playlist under the alias key `playlist` instead of `playlistUrl`.

#### Example input

```json
{
    "playlistUrl": "https://www.youtube.com/playlist?list=PLbpi6ZahtOH6Blw3RGYpWkSByi_T7Rygb",
    "maxResults": 100,
    "proxyCountryCode": "US"
}
```

#### Example output row

```json
{
    "playlistId": "UU8butISFwT-Wl7EV0hUK0BQ",
    "playlistTitle": "Uploads from freeCodeCamp.org",
    "videoId": "XgqWCiOVh7A",
    "title": "How to think like a programmer",
    "url": "https://www.youtube.com/watch?v=XgqWCiOVh7A",
    "index": 1,
    "duration": "1:00",
    "views": "2.3K views",
    "channelName": "freeCodeCamp.org",
    "published": "18 hours ago",
    "thumbnail": "https://i.ytimg.com/vi/XgqWCiOVh7A/hqdefault.jpg"
}
```

### How it works

1. **Extract the playlist id** from a `?list=` parameter in a playlist/watch URL, or from a bare id
   (`PL...`, `UU...`, `OL...`, `FL...`, `RD...`, `LL...`). A leading `VL` browse-id prefix is stripped.
2. **Browse the playlist.** It POSTs to `youtubei/v1/browse` with `browseId = "VL" + playlistId`
   using the **WEB** InnerTube client, which returns up to 100 videos per page.
3. **Page through results.** It follows the `continuationCommand.token` from each response until
   `maxResults` is reached or there are no more pages, de-duplicating by `videoId` and guarding
   against continuation loops.

Requests are routed through Apify residential proxy when available, with an automatic fallback to a
direct connection so a proxy hiccup never fails the run.

### Pricing

This actor uses Apify's **pay-per-event** model. You're charged once per delivered playlist video
(`video-scraped`); error rows are never billed, and the run stops automatically once your budget is
reached.

### Notes & limitations

- The WEB client is required for the `browse` endpoint. The ANDROID/IOS clients cap a playlist at
  \~20 videos with no continuation token, so they cannot page.
- `views`, `published` and `duration` are returned as YouTube's own display text (localized), not
  parsed numbers.
- A few **auto-generated** playlists (for example YouTube's "Trending" list) are served in a special
  layout whose anonymous continuation is capped by YouTube, so only the first page (~20 videos) is
  available for those. Normal user-created and channel-uploads (`UU...`) playlists page fully.
- Private, deleted or region-blocked videos may be omitted by YouTube.
- YouTube can change its internal API at any time; this actor tolerates several response shapes but
  is not covered by an official API contract.

### Tech

Written in **TypeScript** on the Apify SDK. HTTP-only, so builds are fast and runs are cheap.

### License

MIT © Assia Fadli

# Actor input Schema

## `playlistUrl` (type: `string`):

The YouTube playlist to extract. Accepts a playlist URL (https://www.youtube.com/playlist?list=PL...), a watch URL that contains a `list=` parameter, or a bare playlist id (PL..., UU... for a channel's uploads, OL..., etc.).

## `maxResults` (type: `integer`):

Maximum number of videos to return. Videos are fetched in playlist order in pages of ~100. You are charged once per delivered video.

## `proxyCountryCode` (type: `string`):

Optional two-letter country code for the Apify residential proxy exit IP (e.g. "US", "GB", "DE"). Leave blank to let Apify choose. If the proxy is unavailable the actor falls back to a direct request.

## Actor input object example

```json
{
  "playlistUrl": "https://www.youtube.com/playlist?list=PLbpi6ZahtOH6Blw3RGYpWkSByi_T7Rygb",
  "maxResults": 100,
  "proxyCountryCode": "US"
}
```

# 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 = {
    "playlistUrl": "https://www.youtube.com/playlist?list=PLbpi6ZahtOH6Blw3RGYpWkSByi_T7Rygb",
    "maxResults": 100,
    "proxyCountryCode": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("receptional_blender/youtube-playlist-extractor").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 = {
    "playlistUrl": "https://www.youtube.com/playlist?list=PLbpi6ZahtOH6Blw3RGYpWkSByi_T7Rygb",
    "maxResults": 100,
    "proxyCountryCode": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("receptional_blender/youtube-playlist-extractor").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 '{
  "playlistUrl": "https://www.youtube.com/playlist?list=PLbpi6ZahtOH6Blw3RGYpWkSByi_T7Rygb",
  "maxResults": 100,
  "proxyCountryCode": "US"
}' |
apify call receptional_blender/youtube-playlist-extractor --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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