yt-dlp(1) yt-dlp(1) (NAME) yt-dlp - / (SYNOPSIS) yt-dlp [OPTIONS] URL [URL...] (DESCRIPTION) yt-dlp / . youtube-dl (https://github.com/ytdl- org/youtube-dl) youtube-dlc (https://github.com/blackjack4494/yt- dlc) . (OPTIONS) (General Options): -h, --help --version -U, --update --no-update () --update-to [CHANNEL]@[TAG] . CHANNEL . CHANNEL TAG "stable" "latest" "UPDATE" . : stable nightly master -i, --ignore-errors . --no-abort-on-error () --abort-on-error ( : --no- ignore-errors) --list-extractors --extractor-descriptions --use-extractors NAMES . (regexes) "all" "default" "end" ( ) : --ies "holodex.*,end,youtube". "-" : --ies default,-generic. --list-extractors . ( : --ies) --default-search PREFIX (unqualified). : "gvsearch2:python" google videos "python" . "auto" yt-dlp ("auto_warning" ). "error" . "fixup_error" --ignore-config --config-locations. . ( : --no-config) --no-config-locations (). --config-locations --config-locations PATH ("-" stdin). --plugin-dirs DIR . . "default" () --no-plugin-dirs --plugin-dirs --js-runtimes RUNTIME[:PATH] ( ). . ( ): deno node quickjs bun. "deno" . . "deno" --no-js-runtimes --no-js-runtimes --js-runtimes --remote-components COMPONENT yt-dlp . yt-dlp-ejs . . : ejs:npm ( npm) ejs:github ( yt-dlp-ejs). --no-remote-components --remote-components . --flat-playlist --no-flat-playlist () --live-from-start . YouTube Twitch TVer mellow-fan --no-live-from-start () --wait-for-video MIN[-MAX] . ( ) --no-wait-for-video () --mark-watched ( --simulate) --no-mark-watched () --color [STREAM:]POLICY STREAM ( stdout stderr) . "always" "auto" () "never" "no_color" ( ) . "auto-tty" "no_color-tty" . .TP --compat-options OPTS yt- dlp youtube-dl youtube- dlc . "Differences in default behavior" . --alias ALIASES OPTIONS (alias) . "-" "--" . (Python string formatting mini-language) . : --alias get-audio,-X "-S aext:{0},abr -x --audio- format {0}" "--get-audio" "-X" (ARG0) "-S aext:ARG0,abr -x --audio-format ARG0" . --help . . . . -t, --preset-alias PRESET . : --preset-alias mp3. : mp3 aac mp4 mkv sleep. "Preset Aliases" . . (Network Options): --proxy URL () HTTP/HTTPS/SOCKS. SOCKS (scheme) : socks5://user:pass@127.0.0.1:1080/. (--proxy "") . --socket-timeout SECONDS . --source-address IP IP (bind). --impersonate CLIENT[:OS] (impersonate). : chrome chrome-110 chrome:windows-10. --impersonate="" . . --list-impersonate-targets . -4, --force-ipv4 IPv4. -6, --force-ipv6 IPv6. --enable-file-urls file://. . (Geo-restriction): --geo-verification-proxy URL () IP . --proxy ( ) . --xff VALUE HTTP X-Forwarded-For . "default" ( ) "never" IP CIDR ISO 3166-2. (Video Selection): -I, --playlist-items ITEM_SPEC playlist_index . "[START]:[STOP][:STEP]" . START-STOP . STEP . : "-I 1:3,7,-5::2" 1,2,3,7,11,13,15 . --min-filesize SIZE SIZE : 50k 44.6M. --max-filesize SIZE SIZE : 50k 44.6M. --date DATE . "YYYYMMDD" [now|today|yesterday][-N[day|week|month|year]] . : "--date today-2weeks" . --datebefore DATE . --date . --dateafter DATE . --date . --match-filters FILTER . "OUTPUT TEMPLATE" "Filtering Formats" . "!field" "&" . "" (escape) "&" . . : --match-filters !is_live --match-filters "like_count>?100 & description~='(?i)& dogs" (like) ( like ) "cats & dogs" ( ). "--match-filters -" . --no-match-filters --match-filters (). --break-match-filters FILTER "--match-filters" . --no-break-match-filters --break-match-filters (). --no-playlist . --yes-playlist . --age-limit YEARS . --download-archive FILE (archive) . (ID) . --no-download-archive (). --max-downloads NUMBER NUMBER . --break-on-existing --download- archive . --no-break-on-existing (). --break-per-input --max-downloads --break-on- existing --break-match-filters autonumber . --no-break-per-input --break-on-existing . --skip-playlist-after-errors N ..SS (Download Options): -N, --concurrent-fragments N dash/hlsnative ( 1 ) -r, --limit-rate RATE 50K 4.2M --throttled-rate RATE (throttling) 100K -R, --retries RETRIES ( 10 ) "infinite" () --file-access-retries RETRIES ( 3 ) "infinite" --fragment-retries RETRIES ( 10 ) "infinite" ( DASH hlsnative ISM) --retry-sleep [TYPE:]EXPR ( http () fragment file_access extractor) . EXPR linear=START[:END[:STEP=1]] exp=START[:END[:BASE=2]] . : --retry-sleep linear=1::2 --retry-sleep fragment:exp=1:20 --skip-unavailable-fragments DASH hlsnative ISM () ( : --no- abort-on-unavailable-fragments) --abort-on-unavailable-fragments ( : --no-skip-unavailable-fragments) --keep-fragments --no-keep-fragments () --buffer-size SIZE 1024 16K ( 1024 ) --resize-buffer --buffer-size () --no-resize-buffer --http-chunk-size SIZE HTTP 10485760 10M ( ). () --playlist-random --lazy-playlist . n_entries --playlist-random --playlist-reverse --no-lazy-playlist () --hls-use-mpegts mpegts HLS . --no-hls-use-mpegts mpegts HLS. --download-sections REGEX (chapters) . "*" . . "*from-url" "start_time" "end_time" URL . ffmpeg . : --download-sections "*10:15-inf" --download- sections "intro" --downloader [PROTO:]NAME (http ftp m3u8 dash rtmp) . native aria2c axel curl ffmpeg httpie wget . . : --downloader aria2c --downloader "dash,m3u8:native" aria2c http/ftp (native) dash/m3u8 ( : --external-downloader) --downloader-args NAME:ARGS . ":" . ffmpeg --postprocessor-args . ( : --external-downloader-args).SS : -a, --batch-file FILE (URL) ("-" stdin) URL . "#" ";" "]" () . --no-batch-file () -P, --paths [TYPES:]PATH . (":") . TYPES --output . "home" () "temp" . temp home . --output . -o, --output [TYPES:]TEMPLATE "OUTPUT TEMPLATE" --output-na-placeholder TEXT --output (: "NA") --restrict-filenames ASCII "&" --no-restrict-filenames "&" () --windows-filenames Windows --no-windows-filenames --trim-filenames LENGTH ( ) -w, --no-overwrites --force-overwrites (). --no-continue --no-force-overwrites () -c, --continue / () --no-continue . --part .part () --no-part .part - --mtime Last-modified --no-mtime Last- modified () --write-description .description --no-write-description () --write-info-json .info.json ( ) --no-write-info-json () --write-playlist-metafiles --write-info- json --write-description () --no-write-playlist-metafiles --write-info-json --write- description --clean-info-json infojson () --no-clean-info-json infojson --write-comments infojson. ( : --get-comments) --no-write-comments ( : --no-get-comments) --load-info-json FILE JSON ( "--write-info-json") --cookies FILE Netscape --no-cookies / / () --cookies-from-browser BROWSER[+KEYRING][:PROFILE][::CONTAINER] . : brave chrome chromium edge firefox opera safari vivaldi whale. KEYRING Chromium Linux / PROFILE CONTAINER ( Firefox) ( "none" ) . . (keyrings) : basictext gnomekeyring kwallet kwallet5 kwallet6 --no-cookies-from-browser () --cache-dir DIR yt- dlp ( ) . ${XDG_CACHE_HOME}/yt-dlp --no-cache-dir () --rm-cache-dir .SS (Thumbnail Options): --write-thumbnail --no-write-thumbnail () --write-all-thumbnails --list-thumbnails . --no- simulate (Internet Shortcut Options): --write-link (.url .webloc .desktop). (URL) () --write-url-link .url. (URL) () --write-webloc-link .webloc --write-desktop-link .desktop (Verbosity and Simulation Options): -q, --quiet . --verbose stderr --no-quiet . () --no-warnings -s, --simulate --no-simulate / --ignore-no-formats-error "No video formats". () --no-ignore-no-formats-error () --skip-download ( : --no-download) -O, --print [WHEN:]TEMPLATE ":" . "WHEN" --use-postprocessor (: video). --quiet . --simulate --no-simulate WHEN . --print-to-file [WHEN:]TEMPLATE FILE . WHEN TEMPLATE --print . FILE . -j, --dump-json JSON . --no- simulate . "OUTPUT TEMPLATE" -J, --dump-single-json JSON URL infojson . --no-simulate . URL --force-write-archive -s ( : --force-download-archive) --newline --no-progress --progress --console-title --progress-template [TYPES:]TEMPLATE "download:" () "download-title:" ( ) "postprocess:" "postprocess-title:". "info" "progress" . : --console-title --progress-template "download- title:%(info.id)s-%(progress.eta)s" --progress-delta SECONDS (: 0) -v, --verbose --dump-pages base64 ( ) --write-pages --print-traffic HTTP.SS (Workarounds): --encoding ENCODING () --legacy-server-connect HTTPS RFC 5746 secure renegotiation --no-check-certificates HTTPS --prefer-insecure --add-headers FIELD:VALUE HTTP ":". --bidi-workaround . bidiv fribidi PATH --sleep-requests SECONDS --sleep-interval SECONDS . --max- sleep-interval ( : --min-sleep-interval) --max-sleep-interval SECONDS . --min-sleep- interval --sleep-subtitles SECONDS (Video Format Options): -f, --format FORMAT "FORMAT SELECTION" -S, --format-sort SORTORDER "Sorting Formats" --format-sort-reset --format-sort-force "Sorting Formats" ( : --S-force) --no-format-sort-force () --video-multistreams --no-video-multistreams () --audio-multistreams --no-audio-multistreams () --prefer-free-formats . "-S ext" --no-prefer-free-formats () --check-formats --check-all-formats --no-check-formats -F, --list-formats . --no- simulate --merge-output-format FORMAT "/" "mp4/mkv". . ( : avi, flv, mkv, mov, mp4, webm).SS (Subtitle Options): --write-subs --no-write-subs () --write-auto-subs ( : --write- automatic-subs) --no-write-auto-subs () ( : --no-write-automatic-subs) --list-subs . --no- simulate --sub-format FORMAT "/" "srt" "ass/srt/best" --sub-langs LANGS ( ) "all" --sub-langs "en.*,ja" ( "en.*" "en" ). "-" --sub- langs all,-live_chat. --list-subs (Authentication Options): -u, --username USERNAME -p, --password PASSWORD . yt-dlp -2, --twofactor TWOFACTOR -n, --netrc .netrc --netrc-location PATH .netrc . ~/.netrc --netrc-cmd NETRC_CMD (extractor) . --video-password PASSWORD --ap-mso MSO ( ) Adobe Pass MSO --ap-list-mso --ap-username USERNAME --ap-password PASSWORD . yt-dlp --ap-list-mso --client-certificate CERTFILE PEM. --client-certificate-key KEYFILE --client-certificate-password PASSWORD . yt-dlp .SS " (Post- Processing Options):" -x, --extract-audio ( ffmpeg ffprobe). --audio-format FORMAT -x. ( : best () aac alac flac m4a mp3 opus vorbis wav). --remux-video . --audio-quality QUALITY ffmpeg -x . 0 () 10 () VBR 128K ( 5). --remux-video FORMAT (remux) ( : avi flv gif mkv mov mp4 webm aac aiff alac flac m4a mka mp3 ogg opus vorbis wav). / . "aac>m4a/mov>mp4/mkv" aac m4a mov mp4 mkv . --recode-video FORMAT (re-encode) . --remux-video . --postprocessor-args NAME:ARGS . / ":" / . (PP) : Merger ModifyChapters SplitChapters ExtractAudio VideoRemuxer VideoConvertor Metadata EmbedSubtitle EmbedThumbnail SubtitlesConvertor ThumbnailsConvertor FixupStretched FixupM4a FixupM3u8 FixupTimestamp FixupDuration. : AtomicParsley FFmpeg FFprobe. "PP+EXE:ARGS" . ffmpeg/ffprobe "_i"/"_o" / : --ppa "Merger+ffmpeg_i1:-v quiet". . ( : --ppa) -k, --keep-video . --no-keep-video (). --post-overwrites (). --no-post-overwrites . --embed-subs ( mp4 webm mkv). --no-embed-subs (). --embed-thumbnail . --no-embed-thumbnail (). --embed-metadata . /infojson --no-embed-chapters/--no-embed-info-json ( : --add-metadata). --no-embed-metadata () ( : --no-add-metadata). --embed-chapters ( : --add-chapters). --no-embed-chapters () ( : --no-add-chapters). --embed-info-json infojson mkv/mka. --no-embed-info-json infojson . --parse-metadata [WHEN:]FROM:TO / "MODIFYING METADATA" . "WHEN" --use-postprocessor (: pre_process). --replace-in-metadata [WHEN:]FIELDS REGEX REPLACE . . "WHEN" --use-postprocessor (: pre_process). --xattrs (xattrs) ( Dublin Core XDG). --concat-playlist POLICY ( ) . "never" "always" "multi_video" ( ). . "pl_video:" "--paths" "--output" . "OUTPUT TEMPLATE" . --fixup POLICY . never ( ) warn ( ) detect_or_warn ( ) force ( ). --ffmpeg-location PATH ffmpeg . --exec [WHEN:]CMD ":" . "WHEN" --use-postprocessor (: after_move). : "i"/"d" ( ) "f" ( ) "q" ( ). %(filepath,_filename|)q . . --no-exec --exec . --convert-subs FORMAT ( : ass lrc srt vtt). "--convert-subs none" () ( : --convert-subtitles). --convert-thumbnails FORMAT ( : jpg png webp). "--remux-video" . "--convert-thumbnails none" (). --split-chapters . "chapter:" "--paths" "--output" . "OUTPUT TEMPLATE" . --no-split-chapters (). --remove-chapters REGEX . --download-sections . . --no-remove-chapters (). --force-keyframes-at-cuts (keyframes) // . ..TP --no-force-keyframes-at-cuts / (keyframes) () --use-postprocessor NAME[:ARGS] ( ) () ":" . ARGS NAME=VALUE ";" . "when" . "pre_process" ( ) "after_filter" ( ) "video" ( --format --print/--output) "before_dl" ( ) "post_process" ( ) "after_move" ( ) "after_video" ( ) "playlist" ( ) . SponsorBlock (SponsorBlock Options): ( ) YouTube API SponsorBlock (https://sponsor.ajay.app) --sponsorblock-mark CATS SponsorBlock . sponsor intro outro selfpromo preview filler interaction music_offtopic hook poi_highlight chapter all default (=all). "-" . [1] . : --sponsorblock-mark all,-preview [1] https://wiki.sponsor.ajay.app/w/Segment_Categories --sponsorblock-remove CATS SponsorBlock . mark remove remove . --sponsorblock-mark "default" "all,-filler" poi_highlight chapter --sponsorblock-chapter-title TEMPLATE SponsorBlock --sponsorblock-mark . start_time end_time category categories name category_names. : "[SponsorBlock]: %(category_names)l" --no-sponsorblock --sponsorblock-mark --sponsorblock-remove --sponsorblock-api URL API SponsorBlock https://sponsor.ajay.app (Extractor Options): --extractor-retries RETRIES ( ) "infinite" --allow-dynamic-mpd DASH () ( : --no-ignore-dynamic-mpd) --ignore-dynamic-mpd DASH ( : --no-allow- dynamic-mpd) --hls-split-discontinuity HLS --no-hls-split-discontinuity HLS () --extractor-args IE_KEY:ARGS ARGS IE_KEY. "EXTRACTOR ARGUMENTS" . .SS " (Preset Aliases):" . yt- dlp -t mp3 -f 'ba[acodec^=mp3]/ba/b' -x --audio-format mp3 -t aac -f 'ba[acodec^=aac]/ba[acodec^=mp4a.40.]/ba/b' -x --audio-format aac -t mp4 --merge-output-format mp4 --remux-video mp4 -S vcodec:h264,lang,quality,res,fps,hdr:12,a codec:aac -t mkv --merge-output-format mkv --remux-video mkv -t sleep --sleep-subtitles 5 --sleep-requests 0.75 --sleep-interval 10 --max-sleep-interval 20 (CONFIGURATION) yt-dlp . : 1. (Main Configuration): o --config-locations 2. (Portable Configuration): ( ) o yt-dlp.conf o yt-dlp.conf yt_dlp 3. (Home Configuration): o yt-dlp.conf -P o -P 4. (User Configuration): o ${XDG_CONFIG_HOME}/yt-dlp.conf o ${XDG_CONFIG_HOME}/yt-dlp/config ( Linux/macOS) o ${XDG_CONFIG_HOME}/yt-dlp/config.txt o ${APPDATA}/yt-dlp.conf o ${APPDATA}/yt-dlp/config ( Windows) o ${APPDATA}/yt-dlp/config.txt o ~/yt-dlp.conf o ~/yt-dlp.conf.txt o ~/.yt-dlp/config o ~/.yt-dlp/config.txt : 5. (System Configuration): o /etc/yt-dlp.conf o /etc/yt-dlp/config o /etc/yt-dlp/config.txt yt-dlp mtime YouTube : # Lines starting with # are comments # Always extract audio -x # Copy the mtime --mtime # Use this proxy --proxy 127.0.0.1:3128 # Save all videos under YouTube directory in your home directory -o ~/YouTube/%(title)s.%(ext)s : - -- -o --proxy - o -- proxy. . yt-dlp --ignore-config . --ignore-config . . ( ) --ignore-config ..SS UTF BOM (locale) . # coding: ENCODING ( : # coding: shift-jis). BOM. netrc ( --username --password) yt-dlp . .netrc (https://stackoverflow.com/tags/.netrc/info) . .netrc --netrc-location / : touch ${HOME}/.netrc chmod a-rwx,u+rw ${HOME}/.netrc extractor : machine login password : machine youtube login myaccount@gmail.com password my_youtube_password machine twitch login my_twitch_account_name password my_twitch_password .netrc --netrc yt-dlp . .netrc ~ ( ). .netrc ( ) . --netrc-cmd netrc 0 . {} . : .netrc .authinfo.gpg yt-dlp --netrc-cmd 'gpg --decrypt ~/.authinfo.gpg' 'https://www.youtube.com/watch?v=YE7VzlLtp-4' o UNIX ${VARIABLE}/$VARIABLE Windows %VARIABLE% ${VARIABLE} o yt-dlp UNIX Windows --output --config-locations o ${XDG_CONFIG_HOME} ~/.config ${XDG_CACHE_HOME} ~/.cache o Windows ~ ${HOME} ${USERPROFILE} ${HOMEDRIVE}${HOMEPATH} o Windows ${USERPROFILE} C:\Users\ ${APPDATA} ${USERPROFILE}\AppData\Roaming .SH " (OUTPUT TEMPLATE)" -o -P . -o yt-dlp -o funny_video.flv "https://some/video" ( ). . (https://docs.python.org/3/library/stdtypes.html#printf-style-string- formatting) %(NAME)s %(NAME)05d. . ( ) : 1. (Object traversal): . %(tags.0)s %(subtitles.en.-1.ext)s. : (slicing) %(id.3:7)s %(id.6:2:-1)s %(formats.:.format_id)s. {} %(formats.:.{format_id,height})#j. %()s infodict %(.{id,title})s. . -j . 2. (Arithmetic): + - * . %(playlist_index+10)03d %(n_entries+1-playlist_index)d 3. / (Date/time Formatting): / strftime (https://docs.python.org/3/library/datetime.html#strftime-and- strptime-format-codes) > . %(duration>%H-%M-%S)s %(upload_date>%Y-%m-%d)s %(epoch-3600>%H-%M-%S)s 4. (Alternatives): , . %(release_date>%Y,upload_date>%Y|Unknown)s 5. (Replacement): & str.format (https://docs.python.org/3/library/string.html#format-specification- mini-language) . . . %(chapters&has chapters|no chapters)s %(title&TITLE={:>20}|NO TITLE)s 6. (Default): | . --output-na-placeholder . %(uploader|Unknown)s 7. (More Conversions): diouxXeEfFgGcrs yt-dlp : B = (Bytes) j = json ( # + Unicode) h = HTML l = (list) ( # \n) q = (quoted) ( # ) D = (Decimal) ( 10M) ( # ) S = (Sanitize) ( # ). 8. (Unicode normalization): U NFC (https://docs.python.org/3/library/unicodedata.html#unicodedata.normalize) . (#) NFD + NFKC/NFKD . %(title)+.100U NFKC . : %(name[.keys][addition][>strf][,alternate][&replacement][|default])[flags][width][.precision][length]type : . subtitle thumbnail description annotation () infojson link pl_thumbnail pl_description pl_infojson chapter pl_video. -o "%(title)s.%(ext)s" -o "thumbnail:%(title)s/%(title)s.%(ext)s" . . --write-thumbnail -o "thumbnail:" . : ( ) . --print after_move:filepath . : o id (string): o title (string): o fulltitle (string): o ext (string): o alt_title (string): o description (string): o display_id (string): o uploader (string): o uploader_id (string): o uploader_url (string): (URL) o license (string): o creators (list): o creator (string): o timestamp (numeric): (UNIX timestamp) o upload_date (string): (UTC) YYYYMMDD o release_timestamp (numeric): o release_date (string): (YYYYMMDD) (UTC) o release_year (numeric): (YYYY) o modified_timestamp (numeric): o modified_date (string): (YYYYMMDD) (UTC) o channel (string): .IP o 2 channel_id (string): o channel_url (string): (URL) o channel_follower_count (numeric): o channel_is_verified (boolean): (verified) o location (string): o duration (numeric): o duration_string (string): (HH:mm:ss) o view_count (numeric): o concurrent_view_count (numeric): o like_count (numeric): () o dislike_count (numeric): () o repost_count (numeric): o average_rating (numeric): o comment_count (numeric): ( ) o save_count (numeric): o age_limit (numeric): ( ) o live_status (string): "not_live" "is_live" "is_upcoming" "was_live" "post_live" ( VOD ) o is_live (boolean): o was_live (boolean): o playable_in_embed (string): (embedded) o availability (string): "private" "premium_only" "subscriber_only" "needs_auth" "unlisted" "public" o media_type (string): "episode" "clip" "trailer" o start_time (numeric): URL o end_time (numeric): URL o extractor (string): o extractor_key (string): o epoch (numeric): (Unix epoch) o autonumber (numeric): --autonumber-start o video_autonumber (numeric): o n_entries (numeric): o playlist_id (string): o playlist_title (string): o playlist (string): playlist_title playlist_id o playlist_count (numeric): . o playlist_index (numeric): () o playlist_autonumber (numeric): o playlist_uploader (string): o playlist_uploader_id (string): o playlist_channel (string): o playlist_channel_id (string): o playlist_webpage_url (string): (URL) o webpage_url (string): (URL) yt-dlp o webpage_url_basename (string): (basename) o webpage_url_domain (string): (domain) o original_url (string): (URL) ( webpage_url ) o categories (list): o tags (list): o cast (list): Filtering Formats : o chapter (string): o chapter_number (numeric): o chapter_id (string): : o series (string): o series_id (string): o season (string): o season_number (numeric): o season_id (string): o episode (string): o episode_number (numeric): o episode_id (string): : o track (string): o track_number (numeric): o track_id (string): .IP o 2 artists (): () o artist (): () o genres (): () o genre (): () o composers (): () o composer (): () o album (): o album_type (): o album_artists (): o album_artist (): o disc_number (): --download-sections chapter: --split-chapters : o section_title (): o section_number (): o section_start (): o section_end (): --print : o urls (): (URL) o filename (): . o formats_table (): --list-formats o thumbnails_table (): --list-thumbnails o subtitles_table (): --list-subs o automatic_captions_table (): --list-subs (post_process/after_move) : o filepath: --sponsorblock-chapter-title : o start_time (): o end_time (): o categories (): SponsorBlock (https://wiki.sponsor.ajay.app/w/Types#Category) o category (): SponsorBlock o category_names (): o name (): o type (): SponsorBlock (https://wiki.sponsor.ajay.app/w/Types#Action_Type) . -o %(title)s-%(id)s.%(ext)s mp4 yt-dlp test video YE7VzlLtp-4 yt-dlp test video-YE7VzlLtp-4.mp4 . : . --output-na-placeholder ( NA) . : -j URL (https://docs.python.org/3/library/stdtypes.html#printf-style-string- formatting) %(view_count)05d 00042. -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" . . %% . stdout -o - . %(title)s [%(id)s].%(ext)s . & Windows . --restrict-filenames ..SS " (Output template examples)" $ yt-dlp --print filename -o "test video.%(ext)s" ptd1NN40vMw test video.webm # $ yt-dlp --print filename -o "%(title)s.%(ext)s" ptd1NN40vMw To'y!.webm # $ yt-dlp --print filename -o "%(title)s.%(ext)s" ptd1NN40vMw --restrict-filenames To_y.webm # # $ yt-dlp -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" "https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re" # $ yt-dlp -o "%(upload_date>%Y)s/%(title)s.%(ext)s" "https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re" # " - " $ yt-dlp -o "%(playlist_index&{} - |)s%(title)s.%(ext)s" YE7VzlLtp-4 "https://www.youtube.com/user/TheLinuxFoundation/playlists" # / : $ yt-dlp -o "%(uploader)s/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" "https://www.youtube.com/user/TheLinuxFoundation/playlists" # Udemy MyVideos $ yt-dlp -u user -p password -P "~/MyVideos" -o "%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s" "https://www.udemy.com/java-tutorial" # C:/MyVideos $ yt-dlp -P "C:/MyVideos" -o "%(series)s/%(season_number)s - %(season)s/%(episode_number)s - %(episode)s.%(ext)s" "https://videomore.ru/kino_v_detalayah/5_sezon/367617" # "C:\MyVideos\uploader\title.ext" "C:\MyVideos\subs\uploader\title.ext" # "C:\MyVideos\tmp" $ yt-dlp -P "C:/MyVideos" -P "temp:tmp" -P "subtitle:subs" -o "%(uploader)s/%(title)s.%(ext)s" YE7VzlLtp-4 --write-subs # "C:\MyVideos\uploader\title.ext" "C:\MyVideos\uploader\subs\title.ext" $ yt-dlp -P "C:/MyVideos" -o "%(uploader)s/%(title)s.%(ext)s" -o "subtitle:%(uploader)s/subs/%(title)s.%(ext)s" YE7VzlLtp-4 --write-subs # (stdout) $ yt-dlp -o - YE7VzlLtp-4 (FORMAT SELECTION) yt- dlp . -f bestvideo*+bestaudio/best . (--audio-multistreams) -f bestvideo+bestaudio/best . ffmpeg yt-dlp stdout (-o -) -f best/bestvideo+bestaudio . : yt-dlp ffmpeg stdout . -f bv*+ba/b . -f b/bv+ba . -f FORMAT ( --format FORMAT) FORMAT . -f 22 . --list-formats -F . . ( 3gp aac flv m4a mp3 mp4 ogg wav webm ) -f webm webm . -f - . : o all: o mergeall: ( --audio-multistreams --video-multistreams ) o b* best*: ( vcodec!=none or acodec!=none) o b best: . best*[vcodec!=none][acodec!=none] o bv bestvideo: . best*[acodec=none] o bv* bestvideo*: . . best*[vcodec!=none] o ba bestaudio: . best*[vcodec=none] o ba* bestaudio*: . . best*[acodec!=none] ( ! (https://github.com/yt- dlp/yt-dlp/issues/979#issuecomment-919629354)) o w* worst*: o w worst: . worst*[vcodec!=none][acodec!=none] o wv worstvideo: . worst*[acodec=none] o wv* worstvideo*: . . worst*[vcodec!=none] o wa worstaudio: . worst*[vcodec=none] o wa* worstaudio*: . . worst*[acodec!=none] -f worstvideo . worst . worst . . -f worst -S +size -S +size,+br,+res,+fps . << >> (Sorting Formats) . n- best. . best.2 . bv*.3 . () . -f 22/17/18 . -f 22,17,18 ( ) . : -f 136/137/mp4/bestvideo,140/m4a/bestaudio. -f ++... ( ffmpeg ) -f bestvideo+bestaudio ffmpeg (mux) ..PP : multistreams . / . --video-multistreams . --audio-multistreams . : -f bestvideo+best+bestaudio --video-multistreams --audio-multistreams . . -f bestvideo+best+bestaudio --no-video-multistreams bestvideo bestaudio . best (bestvideo) . . -f best+bestaudio --no-audio-multistreams best -f bestaudio+best --no-audio-multistreams best bestaudio . (Filtering Formats) -f "best[height=720]" ( -f "[filesize>10M]" best ). < <= > >= = () != () : o filesize: o filesize_approx: o width: o height: o aspect_ratio: o tbr: kbps o abr: kbps o vbr: kbps o asr: o fps: o audio_channels: o stretched_ratio: width:height = () ^= ( ) $= ( ) *= () ~= ( ) : o url: (URL) o ext: o acodec: o vcodec: o container: (container) o protocol: (http https rtmp rtmpe f4m ism http_dash_segments m3u8 m3u8_native) o language: o dynamic_range: (dynamic range) o format_id: o format: o format_note: o resolution: ! !*= ( ). ._- . : . . (?) . -f "bv[height<=?720][tbr>500]" 720p ( ) 500 kbps . all -f "all[vcodec=none]" . -f "(mp4,webm)[height<480]" mp4 webm 480 ..SS -S (--format-sort) best . --format-sort field1,field2... . : o hasvid: o hasaud: o ie_pref: o lang: ( ) o quality: o source: o proto: (https/ftps > http/ftp > m3u8_native/m3u8 > http_dash_segments> websocket_frag > f4f/f4m) o vcodec: (av01 > vp9.2 > vp9 > h265 > h264 > vp8 > h263 > theora > ) o acodec: (flac/alac > wav/aiff > opus > vorbis > aac > mp4a > mp3 > ac4 > eac3 > ac3 > dts > ) o codec: vcodec,acodec o vext: (mp4 > mov > webm > flv > ). --prefer-free-formats webm . o aext: (m4a > aac > mp3 > ogg > opus > webm > ). --prefer-free-formats : ogg > opus > webm > mp3 > m4a > aac o ext: vext,aext o filesize: o fs_approx: o size: o height: o width: o res: . o fps: o hdr: (DV > HDR12 > HDR10+ > HDR10 > HLG > SDR) o channels: o tbr: kbps o vbr: kbps o abr: kbps o br: kbps tbr/vbr/abr o asr: Hz : ( ) . . . + . +res . : . res:720 720p 720p . codec ext . +codec:avc:m4a ( +vcodec:avc,+acodec:m4a) h264 > h265 > vp9 > vp9.2 > av01 > vp8 > h263 > theora mp4a > aac > vorbis > opus > mp3 > ac3 > dts . ~ . filesize~1G 1 GiB . hasvid ie_pref . --format-sort-force . : lang,quality,res,fps,hdr:12,vcodec,channels,acodec,size,br,asr,proto,ext,hasaud,source,id. . hdr hdr:12 Dolby Vision . DV . . worst . . . : -f best -S +size,+br,+res,+fps. -S/--format-sort . -S proto -S res -S res,proto -S res:720,fps -S vcodec,res:1080 -S vcodec,res:1080,fps . --format-sort-reset -S/--format-sort . : -v -F ( ) ..SS " (Format Selection examples)" # - - # - $ yt-dlp -f "bv+ba/b" # # - $ yt-dlp -f "bv*+ba/b" # $ yt-dlp # - - # # bestvideo bestaudio . $ yt-dlp -f "bv,ba" -o "%(title)s.f%(format_id)s.%(ext)s" # # - $ yt-dlp -f "bv*+mergeall[vcodec=none]" --audio-multistreams # # - $ yt-dlp -f "bv*+ba+ba.2" --audio-multistreams # ( -S) # -S () # ( ) $ yt-dlp -f "wv*+wa/w" # () $ yt-dlp -S "+res" # $ yt-dlp -S "+size,+br" # mp4 mp4 $ yt-dlp -f "bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b" # # ( mp4 > mov > webm > flv. m4a > aac > mp3 ...) $ yt-dlp -S "ext" # 480p # 480p $ yt-dlp -f "bv*[height<=480]+ba/b[height<=480] / wv*+ba/w" # 480p # 480p $ yt-dlp -S "height:480" # 480p # 480p # # $ yt-dlp -S "res:480" # ( ) 50 MB # ( ) 50 MB $ yt-dlp -f "b[filesize<50M] / w" # ( ) 50 MB # ( ) 50 MB $ yt-dlp -f "b" -S "filesize:50M" # ( ) 50 MB $ yt-dlp -f "b" -S "filesize~50M" # HTTP/HTTPS # $ yt-dlp -f "(bv*+ba/b)[protocol^=http][protocol!*=dash] / (bv*+ba/b)" # # (https/ftps > http/ftp > m3u8_native > m3u8 > http_dash_segments ...) $ yt-dlp -S "proto" # h264 h265 # $ yt-dlp -f "(bv*[vcodec~='^((he|a)vc|h26[45])']+ba) / (bv*+ba/b)" # h264 # $ yt-dlp -S "codec:h264" # h264 # $ yt-dlp -S "+codec:h264" # # 720p # ( ) $ yt-dlp -f "((bv*[fps>30]/bv*)[height<=720]/(wv*[fps>30]/wv*)) + ba / (b[fps>30]/b)[height<=720]/(w[fps>30]/w)" # 720p # # $ yt-dlp -S "res:720,fps" # 480p # # $ yt-dlp -S "+res:480,codec,br" --parse-metadata --replace-in-metadata . --replace-in-metadata FIELDS REGEX REPLACE (https://docs.python.org/3/library/re.html#regular-expression-syntax) . (https://docs.python.org/3/library/re.html?highlight=backreferences#re.sub) . --parse-metadata FROM:TO : . TO (https://docs.python.org/3/library/re.html#regular-expression-syntax) ( %(field)s ) . . . --embed-metadata . : o (URL) . additional_urls . : --parse-metadata "description:(?Phttps?://www\.vimeo\.com/\d+)" vimeo . o . meta_ . meta_description description - "description" "synopsis" . meta_ ( meta1_language). meta_ . : . . yt-dlp : -------------------------------------------------------------------------- title track title date upload_date description synopsis description purl comment webpage_url track track_number artist artist artists creator creators uploader uploader_id composer composer composers genre genre genres categories tags album album series album_artist album_artist album_artists disc disc_number show series season_number season_number episode_id episode episode_id episode_sort episode_number language language : .SS " (Modifying metadata examples)" # "Artist - Title" $ yt-dlp --parse-metadata "title:%(artist)s - %(title)s" # (Regex) $ yt-dlp --parse-metadata "description:Artist - (?P.+)" # episode title ( ) $ yt-dlp --parse-metadata "episode:title" # "Series name S01E05" $ yt-dlp --parse-metadata "%(series)s S%(season_number)02dE%(episode_number)02d:%(title)s" # uploader "artist" $ yt-dlp --parse-metadata "%(uploader|)s:%(meta_artist)s" --embed-metadata # "comment" description webpage_url # $ yt-dlp --parse-metadata "description:(?s)(?P.+)" --embed-metadata # "synopsis" $ yt-dlp --parse-metadata ":(?P)" # "formats" infojson $ yt-dlp --parse-metadata "video::(?P)" --write-info-json # "_" title uploader `-` $ yt-dlp --replace-in-metadata "title,uploader" "[ _]" "-" (EXTRACTOR ARGUMENTS) --extractor-args KEY:ARGS . ARGS ; () ARG=VAL1,VAL2 : --extractor-args "youtube:player-client=tv,mweb;formats=incomplete" --extractor-args "twitter:api=syndication" : CLI ARG _ - youtube:player-client" youtube:player_client" . : youtube o lang: (title description ) ( ) . en . youtube/_base.py (https://github.com/yt-dlp/yt- dlp/blob/415b4c9f955b1a0391204bd24a7132590e7b3bdb/yt_dlp/extractor/youtube/_base.py#L402-L409) . o skip: hls dash translated_subs m3u8 dash (https://github.com/yt-dlp/yt- dlp/issues/4090#issuecomment-1158102032). o player_client: . : web web_safari web_embedded web_music web_creator mweb ios visionos android android_vr tv tv_downgraded tv_simply. visionos,web . / JavaScript web . yt-dlp web_embedded,tv_downgraded,web (premium) web_creator,tv_downgraded,web . web_music music.youtube.com . web_embedded ( ). tv_downgraded web_embedded android_vr visionos (fallback) . web_creator . web_creator web_music po_token . web_creator . . default all ( ) . - : youtube:player_client=default,-web o player_skip: . configs ( ) webpage ( ) js ( ) initial_data ( / ). (rate-limiting) . #860 (https://github.com/yt-dlp/yt-dlp/pull/860) #12826 (https://github.com/yt-dlp/yt-dlp/issues/12826) . o webpage_skip: . player_response initial_data. . actual player_js_version webpage_skip=player_response . o webpage_client: . web () web_safari o player_params: YouTube . yt-dlp . o player_js_variant: n/sig. : main tcc tce es5 es6 es6_tcc es6_tce tv tv_es6 phone house. main . actual . o player_js_version: n/sig signature_timestamp@hash ( 20348@0004de42). actual . webpage_skip=player_response . o comment_sort: top new () - ( YouTube) o max_comments: . max-comments,max-parents,max-replies,max-replies-per-thread,max-depth. all,all,all,all,all . o 1 max-depth max-replies max-replies-per-thread . o all,all,1000,10,2 (thread) ( ) . 1000,all,100 . o formats: . dashy ( HTTP DASH) duplicate ( dashy) incomplete ( - dash m3u8 https --live-from-start) missing_pot ( PO Token ) o innertube_host: Innertube API API studio.youtube.com youtubei.googleapis.com. . o innertube_key: Innertube API API. API . o raise_incomplete_data: Incomplete Data Received o data_sync_id: Data Sync ID Innertube API. youtube:player_skip=webpage,configs youtubetab:skip=webpage ..IP o 2 visitor_data: (Override) (Visitor Data) Innertube API. player_skip=webpage,configs . : . ( Visitor ID ) o po_token: () (Proof of Origin / PO) . PO CLIENT.CONTEXT+PO_TOKEN : youtube:po_token=web.gvs+XXX,web.player=XXX,web_safari.gvs+YYY. gvs ( Google Video Server) player ( Innertube) subs () o pot_trace: (debug logging) PO Token. true false () o fetch_pot: PO Token . always ( PO Token ) never ( PO Token ) auto ( PO Token ) o jsc_trace: JS Challenge. true false () o use_ad_playback_context: (preroll) . (premium) yt-dlp . mweb web_music . true false () youtube-ejs o jitless: JIT (JIT-less). deno node bun. / . node bun . true false () youtubepot-webpo o bind_to_visitor_id: Visitor Data Visitor ID ( ) WebPO . true () false youtubetab ( YouTube ) o skip: webpage ( ) authcheck ( . #1122 (https://github.com/yt-dlp/yt-dlp/pull/1122) ) o approximate_date: upload_date timestamp flat-playlist. generic o fragment_query: (query) mpd/m3u8 (fragments) fragment_query=VALUE. HLS AES-128 URI key_query URI hls_key . ffmpeg o variant_query: URL (master) m3u8 (variant playlist) variant_query=VALUE o key_query: URL m3u8 URI HLS AES-128 key_query=VALUE. URI hls_key . ffmpeg o hls_key: URI HLS AES-128 ( ) IV ( ) (URI|KEY)[,IV] : generic:hls_key=ABCDEF1234567980,0xFEDCBA0987654321. HLS m3u8 o is_live: HLS live_status - false not_live ( ) is_live o impersonate: () : generic:impersonate=safari,chrome-110. generic:impersonate generic:impersonate=false ().SS vikichannel o video_types: - episodes movies clips trailers youtubewebarchive o check_all: . thumbnails captures gamejolt o comment_sort: hot () you ( ) top new - ( GameJolt) hotstar o res: - sd hd fhd o vcodec: - h264 h265 dvh265 o dr: - sdr hdr10 dv instagram o app_id: X-IG-App-ID API. ios web () niconicochannelplus o max_comments: - 120 tiktok o api_hostname: API api22-normal-c-alisg.tiktokv.com o app_name: API trill o app_version: API - manifest_app_version 34.1.2 o manifest_app_version: API 2023401020 o aid: API 1180 o app_info: API /[app_name]/[app_version]/[manifest_app_version]/[aid] iid . iid / tiktok:app_info=1234567890123456789 tiktok:app_info=123,456/trill///1180,789//34.0.1/340001 o device_id: API API . rokfinchannel o tab: - new top videos podcasts streams stacks twitter o api: graphql () legacy syndication API . stacommu, wrestleuniverse o device_id: UUID . (local storage) .SS twitch o client_id: Client ID GraphQL : twitch:client_id=kimne78kx3ncx6brgo4mv6wki5h1ko nhkradirulive (NHK LIVE) o area: . : sapporo sendai tokyo nagoya osaka hiroshima matsuyama fukuoka. tokyo nflplusreplay o type: ( ) . : full_game full_game_spanish condensed_game all_22. all jiocinema o refresh_token: (UUID) refreshToken (local storage) token accessToken jiosaavn o bitrate: . 16 32 64 128 320. 128,320 afreecatvlive o cdn: CDN API (stream) : gcp_cdn gs_cdn_pc_app gs_cdn_mobile_web gs_cdn_pc_web soundcloud o formats: API. {protocol}_{codec} : hls_opus,http_aac. * (wildcard) : *_mp3 . http hls hls-aes aac opus mp3 . download . : http_aac,hls_aac,http_opus,hls_opus,http_mp3,hls_mp3 orfon (orf:on) o prefer_segments_playlist: . : --concat-playlist never --extractor-args "orfon:prefer_segments_playlist" bilibili o prefer_multi_flv: flv mp4 (legacy) sonylivseries o sort_order: - asc ( ) desc ( ). asc streaks o api_key: API X-Streaks-Api-Key tver o backend: Backend - streaks () brightcove () vimeo o client: . android web . . web () . android OAuth o original_format_policy: . always never auto. auto Vimeo API (rate-limit) .SS zan o split_angles: . ffmpeg . true false () : (INSTALLATION) yt-dlp pip (https://pypi.org/project/yt- dlp) . (https://github.com/yt-dlp/yt- dlp/wiki/Installation) : (manpages) (autocomplete) tarball (https://github.com/yt-dlp/yt- dlp/releases/latest/download/yt-dlp.tar.gz) (UPDATE) yt-dlp -U pip (https://github.com/yt-dlp/yt- dlp/wiki/Installation#with-pip) (https://github.com/yt- dlp/yt-dlp/wiki/Installation#third-party-package-managers) : stable nightly master. o stable () . nightly master stable stable "" ( yt-dlp ). o nightly UTC . yt-dlp . nightly yt-dlp/yt- dlp-nightly-builds (https://github.com/yt-dlp/yt-dlp-nightly- builds/releases) PyPI yt-dlp ( --pre pip ) . o master ("canary") push master . (regressions) . master yt-dlp/yt-dlp- master-builds (https://github.com/yt-dlp/yt-dlp-master- builds/releases) . --update/-U . --update-to CHANNEL . --update-to [CHANNEL@]TAG . --update-to (/) . . : o yt-dlp --update-to master master o yt-dlp --update-to stable@2023.07.06 / 2023.07.06 stable o yt-dlp --update-to 2023.10.07 / 2023.10.07 o yt-dlp --update-to example/yt-dlp@2023.09.24 / example/yt-dlp 2023.09.24 : stable nightly : # To update to nightly from stable executable/binary: yt-dlp --update-to nightly # To install nightly with pip: python -m pip install -U --pre "yt-dlp[default]" yt-dlp . --no-update ..SS " (DEPENDENCIES)" 3.10 Python (CPython) 3.11 (PyPy) . . ffmpeg ffprobe yt-dlp-ejs / JavaScript . (Strongly recommended) o ffmpeg ffprobe (https://www.ffmpeg.org) - . (https://www.ffmpeg.org/legal.html) ffmpeg yt-dlp/FFmpeg-Builds (https://github.com/yt-dlp/FFmpeg-Builds) . yt-dlp (patches) (upstream) ffmpeg . readme (https://github.com/yt-dlp/FFmpeg-Builds#patches-applied) . : ffmpeg Python (https://pypi.org/project/ffmpeg) o yt-dlp-ejs (https://github.com/yt-dlp/ejs) - YouTube . Unlicense (https://github.com/yt- dlp/ejs/blob/main/LICENSE) MIT (https://github.com/davidbonnet/astring/blob/main/LICENSE) ISC (https://github.com/meriyah/meriyah/blob/main/LICENSE.md) . / JavaScript deno (https://deno.land) () node.js (https://nodejs.org) bun (https://bun.sh) QuickJS (https://bellard.org/quickjs) yt-dlp-ejs . (https://github.com/yt-dlp/yt- dlp/wiki/EJS) . (Networking) o certifi (https://github.com/certifi/python-certifi)* - Mozilla . MPLv2 (https://github.com/certifi/python- certifi/blob/master/LICENSE) o brotli (https://github.com/google/brotli)* brotlicffi (https://github.com/python-hyper/brotlicffi) - Brotli (https://en.wikipedia.org/wiki/Brotli). MIT 1 (https://github.com/google/brotli/blob/master/LICENSE) 2 (https://github.com/python-hyper/brotlicffi/blob/master/LICENSE) o websockets (https://github.com/aaugustin/websockets)* - websocket. BSD-3-Clause (https://github.com/aaugustin/websockets/blob/main/LICENSE) o requests (https://github.com/psf/requests)* - HTTP. HTTPS (persistent connections). Apache-2.0 (https://github.com/psf/requests/blob/main/LICENSE) (Impersonation) . TLS (TLS fingerprinting) . o curl_cffi (https://github.com/lexiforest/curl_cffi) () - Python curl-impersonate (https://github.com/lexiforest/curl- impersonate). Chrome Edge Safari . MIT (https://github.com/lexiforest/curl_cffi/blob/main/LICENSE) o curl-cffi : pip install "yt-dlp[default,curl-cffi]" o yt-dlp ( zipimport Unix) yt-dlp_x86 ( Windows) o mutagen (https://github.com/quodlibet/mutagen)* - --embed-thumbnail . GPLv2+ (https://github.com/quodlibet/mutagen/blob/master/COPYING) o AtomicParsley (https://github.com/wez/atomicparsley) - --embed-thumbnail mp4/m4a mutagen/ffmpeg . GPLv2+ (https://github.com/wez/atomicparsley/blob/master/COPYING) o xattr (https://github.com/xattr/xattr) pyxattr (https://github.com/iustin/pyxattr) setfattr (http://savannah.nongnu.org/projects/attr) - xattr (--xattrs) Mac BSD. MIT (https://github.com/xattr/xattr/blob/master/LICENSE.txt) LGPL2.1 (https://github.com/iustin/pyxattr/blob/master/COPYING) GPLv2+ (http://git.savannah.nongnu.org/cgit/attr.git/tree/doc/COPYING) (Misc) o pycryptodomex (https://github.com/Legrandin/pycryptodome)* - AES-128 HLS . BSD-2-Clause (https://github.com/Legrandin/pycryptodome/blob/master/LICENSE.rst) o phantomjs (https://github.com/ariya/phantomjs) - JavaScript . YouTube . . BSD-3-Clause (https://github.com/ariya/phantomjs/blob/master/LICENSE.BSD) o secretstorage (https://github.com/mitya57/secretstorage)* - --cookies-from-browser (keyring) Gnome Chromium Linux. BSD-3-Clause (https://github.com/mitya57/secretstorage/blob/master/LICENSE) o --downloader (Deprecated) o rtmpdump (http://rtmpdump.mplayerhq.hu) - rtmp. ffmpeg --downloader ffmpeg . GPLv2+ (http://rtmpdump.mplayerhq.hu) . (standalone) Python * . yt-dlp . --verbose . (COMPILE) PyInstaller (Standalone PyInstaller Builds) Python pyinstaller ( yt-dlp ) . Python . : python devscripts/install_deps.py --include-group pyinstaller python devscripts/make_lazy_extractors.py python -m bundle.pyinstaller python py python3 . python -m bundle.pyinstaller pyinstaller --onefile/-F --onedir/-D (https://pyinstaller.org/en/stable/usage.html#what-to-generate) . : 4.4 Pyinstaller Python Windows Store (https://github.com/pyinstaller/pyinstaller#requirements-and-tested- platforms). : pyinstaller python -m bundle.pyinstaller . ..SS (UNIX) python ( . ) zip make ( GNU) pandoc* pytest* . make . make yt-dlp . ( * ) o devscripts/install_deps.py - yt-dlp. o devscripts/update-version.py - . o devscripts/set-variant.py - (variant) . o devscripts/make_changelog.py - markdown CONTRIBUTORS. o devscripts/make_lazy_extractors.py - (lazy extractors). ( ) . YTDLP_NO_LAZY_EXTRACTORS . : --help . GitHub (build workflow) () artifact . (release workflow) nightly () . (PLUGINS) (import) . ! extractor postprocessor . - (CLI) URL . - . - --use-postprocessor NAME . yt_dlp_plugins.extractor yt_dlp_plugins.postprocessor . : yt_dlp_plugins/ extractor/ myplugin.py postprocessor/ myplugin.py yt-dlp yt_dlp_plugins ( ) . YTDLP_NO_PLUGINS . : (https://github.com/yt- dlp/yt-dlp/wiki/Plugins) . 1. : ( yt_dlp_plugins) : o o ${XDG_CONFIG_HOME}/yt-dlp/plugins//yt_dlp_plugins/ ( Linux/macOS ) o ${XDG_CONFIG_HOME}/yt-dlp-plugins//yt_dlp_plugins/ o ${APPDATA}/yt-dlp/plugins//yt_dlp_plugins/ ( Windows ) o ${APPDATA}/yt-dlp-plugins//yt_dlp_plugins/ o ~/.yt-dlp/plugins//yt_dlp_plugins/ o ~/yt-dlp-plugins//yt_dlp_plugins/ o o /etc/yt-dlp/plugins//yt_dlp_plugins/ o /etc/yt-dlp-plugins//yt_dlp_plugins/ 2. : yt-dlp-plugins ( ): o : /yt-dlp.exe /yt-dlp-plugins//yt_dlp_plugins/ o : /yt_dlp/__main__.py /yt-dlp-plugins//yt_dlp_plugins/ 3. pip PYTHONPATH o pip . yt-dlp-sample- plugins (https://github.com/yt-dlp/yt-dlp-sample-plugins) . o : pip . o PYTHONPATH yt_dlp_plugins . o : Pyinstaller . .zip .egg .whl yt_dlp_plugins . o : ${XDG_CONFIG_HOME}/yt-dlp/plugins/mypluginpkg.zip mypluginpkg.zip yt_dlp_plugins//myplugin.py . yt-dlp --verbose ..SS " (Developing Plugins)" yt-dlp-sample-plugins (https://github.com/yt-dlp/yt-dlp- sample-plugins) Plugin Development (https://github.com/yt-dlp/yt-dlp/wiki/Plugin-Development) . IE/PP (extractors) (postprocessors) (import) . ( _MyBasePluginIE ) __all__ . ( _myplugin.py). plugin_name ( class MyPluginIE(ABuiltInIE, plugin_name='myplugin') ABuiltInIE MyPluginIE ). . (topic) yt-dlp-plugins (https://github.com/topics/yt-dlp-plugins) . Developer Instructions (https://github.com/yt-dlp/yt- dlp/blob/master/CONTRIBUTING.md#developer-instructions) . YT-DLP (EMBEDDING YT-DLP) yt-dlp . (stdout) . -J --print --progress-template --exec . yt-dlp : from yt_dlp import YoutubeDL URLS = ['https://www.youtube.com/watch?v=YE7VzlLtp-4'] with YoutubeDL() as ydl: ydl.download(URLS) . yt_dlp/YoutubeDL.py help(yt_dlp.YoutubeDL) . (CLI) devscripts/cli_to_api.py (https://github.com/yt-dlp/yt-dlp/blob/master/devscripts/cli_to_api.py) YoutubeDL . : youtube-dl yt-dlp YoutubeDL.extract_info json . YoutubeDL.sanitize_info . (Embedding examples) (Extracting information) import json import yt_dlp URL = 'https://www.youtube.com/watch?v=YE7VzlLtp-4' # See help(yt_dlp.YoutubeDL) for a list of available options and public functions ydl_opts = {} with yt_dlp.YoutubeDL(ydl_opts) as ydl: info = ydl.extract_info(URL, download=False) # ydl.sanitize_info makes the info json-serializable print(json.dumps(ydl.sanitize_info(info))) import yt_dlp INFO_FILE = 'path/to/video.info.json' with yt_dlp.YoutubeDL() as ydl: error_code = ydl.download_with_info_file(INFO_FILE) print('Some videos failed to download' if error_code else 'All videos successfully downloaded') import yt_dlp URLS = ['https://www.youtube.com/watch?v=YE7VzlLtp-4'] ydl_opts = { 'format': 'm4a/bestaudio/best', # See help(yt_dlp.postprocessor) for a list of available Postprocessors and their arguments 'postprocessors': [{ # Extract audio using ffmpeg 'key': 'FFmpegExtractAudio', 'preferredcodec': 'm4a', }] } with yt_dlp.YoutubeDL(ydl_opts) as ydl: error_code = ydl.download(URLS) import yt_dlp URLS = ['https://www.youtube.com/watch?v=YE7VzlLtp-4'] def longer_than_a_minute(info, *, incomplete): """Download only videos longer than a minute (or with unknown duration)""" duration = info.get('duration') if duration and duration < 60: return 'The video is too short' ydl_opts = { 'match_filter': longer_than_a_minute, } with yt_dlp.YoutubeDL(ydl_opts) as ydl: error_code = ydl.download(URLS) import yt_dlp URLS = ['https://www.youtube.com/watch?v=YE7VzlLtp-4'] class MyLogger: def debug(self, msg): # For compatibility with youtube-dl, both debug and info are passed into debug # You can distinguish them by the prefix '[debug] ' if msg.startswith('[debug] '): pass else: self.info(msg) def info(self, msg): pass def warning(self, msg): pass def error(self, msg): print(msg) # See "progress_hooks" in help(yt_dlp.YoutubeDL) def my_hook(d): if d['status'] == 'finished': print('Done downloading, now post-processing ...') ydl_opts = { 'logger': MyLogger(), 'progress_hooks': [my_hook], } with yt_dlp.YoutubeDL(ydl_opts) as ydl: ydl.download(URLS) import yt_dlp URLS = ['https://www.youtube.com/watch?v=YE7VzlLtp-4'] # See help(yt_dlp.postprocessor.PostProcessor) class MyCustomPP(yt_dlp.postprocessor.PostProcessor): def run(self, info): self.to_screen('Doing stuff') return [], info with yt_dlp.YoutubeDL() as ydl: # "when" can take any value in yt_dlp.utils.POSTPROCESS_WHEN ydl.add_post_processor(MyCustomPP(), when='pre_process') ydl.download(URLS) import yt_dlp URLS = ['https://www.youtube.com/watch?v=YE7VzlLtp-4'] def format_selector(ctx): """ Select the best video and the best audio that won't result in an mkv. NOTE: This is just an example and does not handle all cases """ # formats are already sorted worst to best formats = ctx.get('formats')[::-1] # acodec='none' means there is no audio best_video = next(f for f in formats if f['vcodec'] != 'none' and f['acodec'] == 'none') # find compatible audio extension audio_ext = {'mp4': 'm4a', 'webm': 'webm'}[best_video['ext']] # vcodec='none' means there is no video best_audio = next(f for f in formats if ( f['acodec'] != 'none' and f['vcodec'] == 'none' and f['ext'] == audio_ext)) # These are the minimum required fields for a merged format yield { 'format_id': f'{best_video["format_id"]}+{best_audio["format_id"]}', 'ext': best_video['ext'], 'requested_formats': [best_video, best_audio], # Must be + separated list of protocols 'protocol': f'{best_video["protocol"]}+{best_audio["protocol"]}' } ydl_opts = { 'format': format_selector, } with yt_dlp.YoutubeDL(ydl_opts) as ydl: ydl.download(URLS) YOUTUBE-DL (CHANGES FROM YOUTUBE-DL) o yt-dlc@f9401f2 (https://github.com/blackjack4494/yt- dlc/commit/f9401f2a91987068139c5f757b12fc711d4c0cee) youtube-dl@a08f2b7 (https://github.com/ytdl-org/youtube- dl/commit/a08f2b7e4567cdc50c0614ee0a4ffdff49b8b6e6) ( (https://github.com/yt-dlp/yt-dlp/issues/21)) o SponsorBlock: API SponsorBlock (https://sponsor.ajay.app) YouTube o : () . -S . --format () o animelover1984/youtube-dl: animelover1984/youtube-dl (https://github.com/animelover1984/youtube- dl) --write-comments BiliBiliSearch BilibiliChannel mp4/ogg/opus infojson . #31 (https://github.com/yt-dlp/yt-dlp/pull/31) . o YouTube: o Clips Stories (ytstories:) ( )* YouTube Music (ytsearch:)* (Mixes) (:ytfav :ytwatchlater :ytsubs :ythistory :ytrec :ytnotif) o n-sig (https://github.com/ytdl-org/youtube- dl/issues/29326) * o --live-from-start () o shorts live o : --cookies-from-browser BROWSER[+KEYRING][:PROFILE][::CONTAINER] o : --download-sections o : --split-chapters o : m3u8/mpd. --concurrent-fragments (-N) o : . (changelog) o (MSO) : Philo Spectrum SlingTV Cablevision RCN . o : . commit/be6202f (https://github.com/yt-dlp/yt- dlp/commit/be6202f12b97858b9d716e608394b51065d0419f) o : . --paths (-P) o : home root . CONFIGURATION o : - . . --parse-metadata --replace-in-metadata o : --alias --print --concat-playlist --wait-for-video --retry-sleep --sleep-requests --convert-thumbnails --force-download-archive --force-overwrites --break-match-filters o : (Regex) --format/--match-filters --postprocessor-args --downloader-args / --config-locations --exec o : . plugins o : yt-dlp -U --update-to o : nightly/master --update-to nightly --update-to master changelog commit (https://github.com/yt-dlp/yt-dlp/commits) .PP * youtube- dl (back-port) . yt-dlp youtube-dl youtube-dlc : o yt-dlp Python 3.10+ (EOL) (https://devguide.python.org/versions/#python-release-cycle) youtube-dl Python 2.6+ 3.2+ (https://github.com/ytdl-org/youtube- dl/issues/30568#issue-1118238743) o --auto-number (-A) --title (-t) --literal (-l) . o avconv ffmpeg o yt-dlp youtube-dl . CONFIGURATION o %(title)s [%(id)s].%(ext)s . . yt-dlp %(title)s-%(id)s.%(ext)s . --compat-options filename o youtube-dl . --format-sort --compat-options format-sort youtube-dl . yt-dlp VP9 --compat-options prefer-vp9-sort . o bv*+ba/b . + - . -f bv+ba/b --compat-options format-spec o youtube-dlc yt-dlp / ( -f bv*+ba ). --audio-multistreams --video-multistreams . --compat-options multistreams o --no-abort-on-error . --abort-on-error --compat-options abort-on-error o infojson ( ) . --no-write-playlist-metafiles --compat-options no-playlist-metafiles o --add-metadata --write-info-json infojson mkv . --no-embed-info-json --compat-options no-attach-info-json o --add-metadata youtube-dl . comment webpage_url synopsis description . --parse-metadata --compat-options embed-metadata o playlist_index --playlist-reverse --playlist-items . #302 (https://github.com/yt-dlp/yt-dlp/issues/302) . --compat-options playlist-index o -F . --compat-options list-formats o ( ) . --sub-langs all,-live_chat . --compat-options no-live-chat live chat/danmaku o YouTube . . . /live . --compat-options no-youtube-channel-redirect o YouTube . --compat-options no-youtube-unavailable-videos o YouTube UTC . o ffmpeg . --compat-options no-direct-merge o mp4 mutagen . AtomicParsley --compat-options embed-thumbnail-atomicparsley o infojson . --no-clean-infojson --compat-options no-clean-infojson o --embed-subs --write-subs . --embed-subs . #630 (comment) (https://github.com/yt-dlp/yt- dlp/issues/630#issuecomment-893659460) . --compat-options no-keep-subs o certifi SSL . ( ) --compat-options no-certifi o yt-dlp youtube-dl / . --compat-options filename-sanitization youtube-dl o ( ) [STRIKEOUT:yt-dlp . --compat-options no-external-downloader-progress ] o yt-dlp 2021.09.01 2022.11.11 ( ) --match-filters . 8f18ac (https://github.com/yt-dlp/yt- dlp/commit/8f18aca8717bb0dd49054555af8d386e5eda3a88) d7b460 (https://github.com/yt-dlp/yt- dlp/commit/d7b460d0e5fc710950582baed2e3fc616ed98a80) . --compat-options playlist-match-filter o yt-dlp 2021.11.10 2023.06.21 ( ) filesize_approx / . f2fe69 (https://github.com/yt- dlp/yt-dlp/commit/f2fe69c7b0d208bdb1f6292b4ae92bc1e1a7444a) 0dff8e (https://github.com/yt-dlp/yt- dlp/commit/0dff8e4d1e6e9fb938f4256ea9af7d81f42fd54f) . --compat-options manifest-filesize-approx o yt-dlp backend http requests . --compat-options prefer-legacy-http-handler http (urllib) http . o swfinterp casefold . o --simulate ( extract_info download=False) . #9843 (https://github.com/yt-dlp/yt-dlp/issues/9843) . o yt-dlp . --mtime --compat-options mtime-by-default . : o --compat-options all: ( !).IP o 2 --compat-options youtube-dl: --compat-options all,-multistreams,-playlist-match-filter,-manifest-filesize-approx,-allow-unsafe-ext,-prefer-vp9-sort,-allow-unsafe-exec-expansion o --compat-options youtube-dlc: --compat-options all,-no-live-chat,-no-youtube-channel-redirect,-playlist-match-filter,-manifest-filesize-approx,-allow-unsafe-ext,-prefer-vp9-sort,-allow-unsafe-exec-expansion o --compat-options 2021: --compat-options 2022,no-certifi,filename-sanitization o --compat-options 2022: --compat-options 2023,playlist-match-filter,no-external-downloader-progress,prefer-legacy-http-handler,manifest-filesize-approx o --compat-options 2023: --compat-options 2024,prefer-vp9-sort o --compat-options 2024: --compat-options 2025,mtime-by-default o --compat-options 2025: . yt-dlp . : o --compat-options allow-unsafe-ext: ( ) (GHSA-79w7-vh3h-8g4j (https://github.com/yt-dlp/yt- dlp/security/advisories/GHSA-79w7-vh3h-8g4j)) :warning: ! (issue) (https://github.com/yt-dlp/yt- dlp/issues/new/choose) ! o --compat-options allow-unsafe-exec-expansion: --exec i/d ( ) f ( ) q ( ) . yt- dlp 2021.04.11 2026.03.17 ( ) . :warning: ! %()q exec . (Deprecated options) (Almost redundant options) -j, --dump-json --print "%()j" -F, --list-formats --print formats_table --list-thumbnails --print thumbnails_table --print playlist:thumbnails_table --list-subs --print automatic_captions_table --print subtitles_table (Redundant options) --get-description --print description --get-duration --print duration_string --get-filename --print filename --get-format --print format --get-id --print id --get-thumbnail --print thumbnail -e, --get-title --print title -g, --get-url --print urls --match-title REGEX --match-filters "title ~= (?i)REGEX" --reject-title REGEX --match-filters "title !~= (?i)REGEX" --min-views COUNT --match-filters "view_count >=? COUNT" --max-views COUNT --match-filters "view_count <=? COUNT" --break-on-reject Use --break-match-filters --user-agent UA --add-headers "User-Agent:UA" --referer URL --add-headers "Referer:URL" --playlist-start NUMBER -I NUMBER: --playlist-end NUMBER -I :NUMBER --playlist-reverse -I ::-1 --no-playlist-reverse Default --no-colors --color no_color . --force-generic-extractor --ies generic,default --exec-before-download CMD --exec "before_dl:CMD" --no-exec-before-download --no-exec --all-formats -f all --all-subs --sub-langs all --write-subs --print-json -j --no-simulate --autonumber-size NUMBER %(autonumber)03d --autonumber-start NUMBER %(autonumber+NUMBER)s --id -o "%(id)s.%(ext)s" --metadata-from-title FORMAT --parse-metadata "%(title)s:FORMAT" --hls-prefer-native --downloader "m3u8:native" --hls-prefer-ffmpeg --downloader "m3u8:ffmpeg" --list-formats-old --compat-options list-formats ( : --no-list-formats-as-table) --list-formats-as-table --compat-options -list-formats [] --geo-bypass --xff "default" --no-geo-bypass --xff "never" --geo-bypass-country CODE --xff CODE --geo-bypass-ip-block IP_BLOCK --xff IP_BLOCK . --test --load-pages --write-pages --allow-unplayable-formats --no-allow-unplayable-formats . --clean-infojson --clean-info-json --force-write-download-archive --force-write-archive --no-clean-infojson --no-clean-info-json --no-split-tracks --no-split-chapters --no-write-srt --no-write-subs --prefer-unsecure --prefer-insecure --rate-limit RATE --limit-rate RATE --split-tracks --split-chapters --srt-lang LANGS --sub-langs LANGS --trim-file-names LENGTH --trim-filenames LENGTH --write-srt --write-subs --yes-overwrites --force-overwrites Sponskrub SponSkrub (https://github.com/faissaloo/SponSkrub) --sponsorblock . --sponskrub --sponsorblock-mark all --no-sponskrub --no-sponsorblock --sponskrub-cut --sponsorblock-remove all --no-sponskrub-cut --sponsorblock-remove -all --sponskrub-force --no-sponskrub-force --sponskrub-location --sponskrub-args . --prefer-avconv avconv yt-dlp ( : --no-prefer-ffmpeg) --prefer-ffmpeg ( : --no-prefer-avconv) -C, --call-home --no-call-home --include-ads --no-include-ads --write-annotations --no-write-annotations --avconv-location --ffmpeg-location --cn-verification-proxy URL --geo-verification-proxy URL --dump-headers --print-traffic --dump-intermediate-pages --dump-pages --youtube-skip-dash-manifest --extractor-args "youtube:skip=dash" ( : --no-youtube-include-dash-manifest) --youtube-skip-hls-manifest --extractor-args "youtube:skip=hls" ( : --no-youtube-include-hls-manifest) --youtube-include-dash-manifest ( : --no-youtube-skip-dash-manifest) --youtube-include-hls-manifest ( : --no-youtube-skip-hls-manifest) --youtube-print-sig-code --dump-user-agent --xattr-set-filesize --compat-options seperate-video-versions --compat-options no-youtube-prefer-utc-upload-date . -A, --auto-number -o "%(autonumber)s-%(id)s.%(ext)s" -t, -l, --title, --literal -o "%(title)s-%(id)s.%(ext)s" (CONTRIBUTING) (Opening an Issue) CONTRIBUTING.md . (WIKI) (https://github.com/yt-dlp/yt-dlp/wiki) . yt-dlp(1)