Skip to the content
EnrichedNowDocs

    Type to search every page.

    Menu

    Scraper APIYouTube

    youtube.playlist

    The videos of a YouTube playlist, in order: title, length, views, age and thumbnail for each, up to 1,000.

    Id
    youtube.playlist
    Version
    1
    Billed per
    record — 1 unit for each record of a charged run
    Runs
    within one request

    Start it with POST /v1/scrapers/youtube.playlist/runs. How runs work is in Running a scraper; what a run costs is in Usage and units.

    Inputs

    The fields of input. A field that is not listed here is refused.

    Inputs of youtube.playlist
    FieldTypeDescription
    playlistrequiredstringThe playlist: its id (PL…, or a channel's uploads list UU…) or any youtube.com address that carries it as list=<id>.Limit: at most 500 characters.
    max_resultsintegerThe most videos to return, in the playlist's order. A playlist loads 100 at a time, so a larger number takes longer.Limit: 1 to 1000. Default: 100.
    • playlist is the playlist's id or any YouTube address that carries it as list=. A channel's uploads list (UU…) is a playlist too. A mix (RD…), which YouTube builds for each viewer, is refused with invalid_input.
    • A playlist loads 100 videos at a time. max_results is 100 by default and goes up to 1,000; a larger number takes longer. If a later batch cannot be loaded, the run ends partial with the videos it has.
    • Videos a playlist hides — private or removed — are not listed by YouTube and are not returned, so a playlist that says "13 videos" can return 10.
    • channel_name and channel_id are filled when the playlist names the video's channel, and for a channel's uploads list; otherwise they are null.
    • A playlist that does not exist, or is private, ends the run failed with not_found.
    • Billed per record: a charged run costs 1 unit for each video it returns.

    Record fields

    Every record of a run has these fields. A value that is not known is null — never an empty string and never 0.

    Record fields of youtube.playlist
    FieldTypeNotes
    positionintegerIts place among the returned videos, from 1, in the playlist's order. Videos the playlist hides (private or removed) are not counted.
    idstringThe video id.
    urlstringThe video's address: youtube.com/watch?v=<id>.
    titlestring or nullThe title as shown.
    playlist_idstringThe id of the playlist that was read.
    playlist_titlestring or nullThat playlist's title.
    channel_namestring or nullThe channel that published the video, when the playlist names it; otherwise the playlist's owner when every video is the owner's.
    channel_idstring or nullThat channel's id (UC…).
    channel_urlstring or nullThat channel's address, as the page links it.
    channel_handlestring or null@name, when the page links the channel by its handle.
    published_textstring or nullWhen the video was published, as shown ("9 years ago").
    duration_textstring or nullThe length as shown ("15:29").
    duration_secondsinteger or nullThe length in seconds, read from duration_text; null when no length is shown.
    view_count_textstring or nullThe views as shown ("4.4M views").
    view_countinteger or nullThe views as a number, when the text reads as one.
    view_count_exactboolean or nullTrue when YouTube showed the count in full, false when it showed it rounded; null when no count was read.
    thumbnailsarray of objectThe video's thumbnail, in the sizes the page lists, smallest first.
    url (in thumbnails[])stringThe image's address.
    width (in thumbnails[])integer or nullIts width in pixels, when the page states it.
    height (in thumbnails[])integer or nullIts height in pixels, when the page states it.

    Example request

    # Start a run and wait up to 60 seconds for it to finish
    curl -X POST "https://api.enrichednow.com/v1/scrapers/youtube.playlist/runs?wait=60" \
      -H "Authorization: Bearer $ENRICHEDNOW_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"input":{"playlist":"PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU","max_results":12}}'
    
    # Read its records, with the id the first call answered
    curl "https://api.enrichednow.com/v1/runs/$RUN_ID/records?limit=100" \
      -H "Authorization: Bearer $ENRICHEDNOW_API_KEY"
    from enrichednow import EnrichedNow
    
    client = EnrichedNow()  # reads ENRICHEDNOW_API_KEY
    
    # Start a run, wait for it to end, and get its records
    result = client.scrape("youtube.playlist", {
        "playlist": "PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU",
        "max_results": 12,
    })
    print(result.run.id, result.run.status, result.run.record_count)
    
    # Read its records: pages are fetched as you go
    for record in result.records:
        print(record)

    Install it with pip install enrichednow, then save as run.py and run python3 run.py

    import EnrichedNow from "enrichednow";
    
    const client = new EnrichedNow(); // reads ENRICHEDNOW_API_KEY
    
    // Start a run, wait for it to end, and get its records
    const { run, records } = await client.scrape("youtube.playlist", {
      playlist: "PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU",
      max_results: 12,
    });
    console.log(run.id, run.status, run.record_count);
    
    // Read its records: pages are fetched as you go
    for await (const record of records) console.log(record);

    Install it with npm install enrichednow, then save as run.mjs and run node run.mjs

    package main
    
    import (
    	"context"
    	"fmt"
    	"log"
    	"time"
    
    	enrichednow "github.com/enrichednow/enrichednow-go"
    )
    
    func main() {
    	client, err := enrichednow.NewClient() // reads ENRICHEDNOW_API_KEY
    	if err != nil {
    		log.Fatal(err)
    	}
    	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
    	defer cancel()
    
    	// Start a run, wait for it to end, and get its records
    	run, records, err := client.Scrape(ctx, "youtube.playlist", map[string]any{"playlist": "PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU", "max_results": 12})
    	if err != nil {
    		log.Fatal(err)
    	}
    	fmt.Println(run.ID, run.Status, run.RecordCount)
    
    	// Read its records: pages are fetched as you go
    	for records.Next() {
    		fmt.Println(string(records.Current()))
    	}
    	if err := records.Err(); err != nil {
    		log.Fatal(err)
    	}
    }

    Install it with go get github.com/enrichednow/enrichednow-go@latest, then save as run.go and run go run run.go

    import com.enrichednow.EnrichedNowClient;
    import com.enrichednow.ScrapeResult;
    import java.util.Map;
    
    public class Run {
        public static void main(String[] args) {
            EnrichedNowClient client = EnrichedNowClient.fromEnv(); // reads ENRICHEDNOW_API_KEY
    
            // Start a run, wait for it to end, and get its records
            ScrapeResult result = client.scrape("youtube.playlist", Map.of("playlist", "PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU", "max_results", 12));
            System.out.println(result.run().id() + " " + result.run().status() + " " + result.run().recordCount());
    
            // Read its records: pages are fetched as you go
            for (Map<String, Object> record : result.records()) {
                System.out.println(record);
            }
        }
    }

    Add com.enrichednow:enrichednow-java:0.4.0 to your Maven or Gradle build, then save as Run.java

    enrichednow run youtube.playlist --input playlist=PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU --input max_results=12

    Install it with curl -fsSL https://raw.githubusercontent.com/enrichednow/enrichednow-cli/main/install.sh | sh

    It starts a run with this scraper’s example input, waits for it to finish and reads its records a page at a time. The key is read from ENRICHEDNOW_API_KEY.

    The body on its own:

    JSON
    {
      "input": {
        "playlist": "PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU",
        "max_results": 12
      }
    }

    Example response

    The run, once it has ended. A run that has not ended within wait comes back with 202 and the status queued or running.

    JSON
    {
      "id": "run_841742f37553189ff9c27ba1",
      "scraper_id": "youtube.playlist",
      "scraper_version": 1,
      "status": "ok",
      "reason": null,
      "input": {
        "playlist": "PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU",
        "max_results": 12
      },
      "record_count": 1,
      "units": 1,
      "units_per_request": null,
      "units_per_record": 1,
      "units_per_page": null,
      "diagnostics": {
        "requests": 1,
        "bytes": 259214,
        "wall_ms": 885,
        "facts": {}
      },
      "created_at": "2026-11-16T22:37:50.170950Z",
      "started_at": "2026-11-16T22:37:50.178331Z",
      "finished_at": "2026-11-16T22:37:51.066313Z"
    }

    Its records, from GET /v1/runs/{id}/records. The record is a real one: this scraper's own parser read it from a page recorded from the site.

    JSON
    {
      "records": [
        {
          "position": 1,
          "id": "YYXdXT2l-Gg",
          "url": "https://www.youtube.com/watch?v=YYXdXT2l-Gg",
          "title": "Python Tutorial for Beginners 1: Install and Setup for Mac and Windows",
          "playlist_id": "PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU",
          "playlist_title": "Python Tutorials",
          "channel_name": null,
          "channel_id": null,
          "channel_url": null,
          "channel_handle": null,
          "published_text": "9 years ago",
          "duration_text": "15:29",
          "duration_seconds": 929,
          "view_count_text": "4.4M views",
          "view_count": 4400000,
          "view_count_exact": false,
          "thumbnails": [
            {
              "url": "https://i.ytimg.com/vi/YYXdXT2l-Gg/hqdefault.jpg?sqp=-oaymwEmCKgBEF5IWvKriqkDGQgBFQAAiEIYAdgBAeIBCggYEAIYBjgBQAE=&rs=AOn4CLAD2NeYN-eWQZCpZFGVNeNNv_UBGA",
              "width": 168,
              "height": 94
            },
            {
              "url": "https://i.ytimg.com/vi/YYXdXT2l-Gg/hqdefault.jpg?sqp=-oaymwEmCMQBEG5IWvKriqkDGQgBFQAAiEIYAdgBAeIBCggYEAIYBjgBQAE=&rs=AOn4CLCd266tPr29bAHihRRuvo2Mdlpg0Q",
              "width": 196,
              "height": 110
            }
          ]
        }
      ],
      "next_cursor": null
    }

    What was done to the record for this page, and nothing else — the API returns every value whole. A text that was cut ends with … [truncated].

    • Shortened: thumbnails: 4 items, the first 2 shown.

    A run does not always end ok. Results and statuses lists every status and the reasons every scraper shares; the reasons of the YouTube scrapers are in their own section there.