All posts
TutorialApril 13, 20264 min read

How to extract video links from a YouTube playlist

Three ways to get every video URL from a YouTube playlist into a flat list — yt-dlp for scripts, the official API for production, and the browser console for one-offs.

By Dawid Sibinski

A YouTube playlist's permalink is one URL; the videos inside are dozens or hundreds. Getting them as a flat list is a common request — for archiving, transcription pipelines, batch downloads, or just sharing.

yt-dlp: the right tool for almost everyone

yt-dlp --flat-playlist --print url "https://youtube.com/playlist?list=PL..." prints one video URL per line. No download, no auth required for public playlists.

Useful flags:

  • --print "%(id)s,%(title)s,%(duration)s" — custom CSV output with title and duration.
  • --dump-single-json — full playlist metadata as one JSON document.
  • --cookies-from-browser chrome — for private/unlisted playlists you can access while signed in.

YouTube Data API v3

For production pipelines, the official API. Endpoint: GET https://youtube.com/v3/playlistItems with playlistId and part=snippet. Each response is a page of up to 50 items; paginate with nextPageToken.

Costs API quota (1 unit per playlistItems.list call). Cheap for personal use, worth measuring at scale. Authentication: API key for public playlists, OAuth for private ones.

Browser console (one-off)

Open the playlist page, scroll to load all videos, then in DevTools console:

[...document.querySelectorAll('a#video-title')].map(a => a.href).join('\n')

Copies a flat list of URLs. Works for one playlist; not great for hundreds.

What's blocked

Mix playlists (the auto-generated "radio" playlists that start with RD) — yt-dlp can list them but they change per session and per user, so the list isn't stable. Watch later and Liked playlists need authentication; pass --cookies-from-browser or use the API with OAuth.

Going further: titles, durations, transcripts

Once you have the URL list, the same yt-dlp command with --print extends it: yt-dlp --flat-playlist --print "%(url)s,%(title)s,%(duration)s,%(uploader)s" gives you a flat CSV of the playlist. Pipe to a file, open in Excel, you have a content audit in 30 seconds.

More on tutorial

Stop reading, start extracting

Drop a PDF or image into ExtractFox and get structured data back in seconds.

Try a free extraction →