ytdlp.org

Practical yt-dlp docs: install, commands, fixes, cookies, and workflows.

Current section

Developer guide

How to get video metadata with yt-dlp (without downloading)

Often you do not want the file at all — you want the title, duration, thumbnail, uploader, or the list of available formats. yt-dlp can extract all of it without downloading a byte of video, which makes it a surprisingly capable metadata tool for anything it can extract from.

Quick answer

# Full metadata as JSON, no download
yt-dlp -j "URL"

# Just the fields you need
yt-dlp --print "%(title)s | %(duration)s | %(thumbnail)s" "URL"

-j prints one JSON object per video and skips the download entirely. --print is the shortcut when you only need a couple of fields and do not want to parse JSON at all.

The JSON is huge — these are the fields that matter

A single video's JSON can run to hundreds of kilobytes, most of it format variants. The fields people actually use:

  • title, duration (seconds), uploader, upload_date (YYYYMMDD)
  • thumbnail — the best thumbnail URL; thumbnails lists every size
  • formats — every available stream with resolution, codec, and bitrate
  • url inside each format — the direct media URL for that stream

One caveat that bites everyone: the direct media URLs are signed and expire after a few hours. They are fine for immediate playback or handing to a downloader right away, but useless in a database. Store the metadata and the original page URL; re-extract when you actually need a stream.

Playlists and channels: use flat extraction

Running -j on a playlist resolves every video individually — one network round-trip each, painfully slow on a large channel. If you only need the listing, tell yt-dlp not to resolve entries:

# Fast: IDs, titles, and URLs for every entry in one request batch
yt-dlp --flat-playlist -J "PLAYLIST_OR_CHANNEL_URL"

-J (uppercase) wraps the whole playlist in a single JSON object with an entries array. The flat entries carry less detail — no formats, sometimes no duration — so the usual pattern is: flat pass to enumerate, then a full -j per video only for the ones you care about.

In Python

The library equivalent is extract_info with download=False:

from yt_dlp import YoutubeDL

with YoutubeDL() as ydl:
    info = ydl.extract_info(url, download=False)
    data = ydl.sanitize_info(info)  # JSON-safe dict

print(data["title"], data["duration"], data["thumbnail"])

sanitize_info strips the internal objects so the dict serializes cleanly. For the full library walkthrough — options, error handling, library vs subprocess — see the Python guide.

The mistake to avoid

Do not scrape metadata at scale from a single IP. Rapid-fire extraction requests with no downloads in between is exactly the request pattern YouTube's bot checks are tuned to catch, and the failure mode is the "Sign in to confirm you're not a bot" wall — which blocks metadata extraction just as thoroughly as it blocks downloads. Rate-limit your own crawler before YouTube does it for you.

For builders

Using yt-dlp inside an app or script?

Paste a link to see what a managed media-import API returns — no install, no signup.

Straightforward yt-dlp help for installs, commands, fixes, cookies, and repeatable workflows.

ytdlp.org is an independent, community-maintained documentation site. It is not affiliated with the yt-dlp project — the official source code lives at github.com/yt-dlp/yt-dlp.