-
yt-dlp, le remplaçant de youtube-dl
INSTALLATION
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp sudo wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp sudo chmod a+rx /usr/local/bin/yt-dlp
UPDATE
sudo yt-dlp -U pip
OPTIONS
yt-dlp [OPTIONS] [--] URL [URL...]
Général
-i, --ignore-errorsThe download will be considered successfull even if the postprocessing fails
--abort-on-errorAbort downloading of further videos if an error occurs
--dump-user-agentDisplay the current user-agent and exit
--list-extractorsList all supported extractors and exit
--extractor-descriptionsOutput descriptions of all supported extractors and exit
--force-generic-extractorForce extraction to use the generic extractor
--default-search PREFIXUse this prefix for unqualified URLs. For example "gvsearch2:" downloads two videos from google videos for the search term "large apple". Use the value "auto" to let yt-dlp guess ("auto_warning" to emit a warning when guessing). "error" just throws an error. The default value "fixup_error" repairs broken URLs, but emits an error if this is not possible instead of searching
--ignore-config, --no-config Disable loading any configuration files except the one provided by --config-location. When given inside a configuration file, no further configuration files are loaded. Additionally, (for backward compatibility) if this option is found inside the system configuration file, the user configuration is not loaded
--config-location PATHLocation of the main configuration file; either the path to the config or its containing directory
--flat-playlistDo not extract the videos of a playlist, only list them
--no-flat-playlistExtract the videos of a playlist
--mark-watchedMark videos watched (even with --simulate). Currently only supported for YouTube
--no-colorsDo not emit color codes in output
--compat-options OPTSOptions that can help keep compatibility with youtube-dl or youtube-dlc configurations by reverting some of the changes made in yt-dlp. See "Differences in default behavior" for detailsVidéo Sélection
--max-downloads NUMBERAbort after downloading NUMBER files
--min-filesize SIZEDo not download any videos smaller than SIZE (e.g. 50k or 44.6m)
--max-filesize SIZEDo not download any videos larger than SIZE (e.g. 50k or 44.6m)
--date DATEonly videos uploaded in this date. The date can be "YYYYMMDD" or in the format "(now|today)[+-][0-9](day|week|month|year)(s)?"
--datebefore DATEDownload only videos uploaded on or before this date. Format identique à --date
--dateafter DATEDownload only videos uploaded on or after this date. Format identique à--date
--match-filter FILTERGeneric video filter. Any field (see "OUTPUT TEMPLATE") can be compared with a number or a string using the operators defined in "Filtering formats". You can also simply specify a field to match if the field is present and "!field" to check if the field is not present. In addition, Python style regular expression matching can be done using "~=", and multiple filters can be checked with "&". Use a "\" to escape "&" or quotes if needed.Ex:
--match-filter "!is_live & like_count>? 00 & description~=’(?i)\bcats \& dogs\b’"matches only videos that are not live, has a like count more than 100 (or the like field is not available), and also has a description that contains the phrase "cats & dogs" (ignoring case)
--age-limit YEARSDownload only videos suitable for the given age
--download-archive FILEDownload only videos not listed in the archive file. Record the IDs of all downloaded videos in it
--break-on-reject Stop the download process when encountering a file that has been filtered out
--skip-playlist-after-errors NNumber of allowed failures until the rest of the playlist is skippedDownload
-N, --concurrent-fragments NNumber of fragments of a dash/hlsnative video that should be download concurrently (default is 1)
-R, --retries RETRIES Number of retries (default is 10), or "infinite"
--abort-on-unavailable-fragment Abort downloading if a fragment is unavailable (Alias: --no-skip-unavailable-fragments)
--keep-fragments Keep downloaded fragments on disk after downloading is finished
--buffer-size SIZE Size of download buffer (e.g. 1024 or 16K) (default is 1024)
--playlist-reverse Download playlist videos in reverse order
--xattr-set-filesize Set file xattribute ytdl.filesize with expected file size
--hls-use-mpegts Use the mpegts container for HLS videos; allowing some players to play the video while downloading, and reducing the chance of file corruption if download is interrupted. This is enabled by default for live streams
--no-hls-use-mpegts Do not use the mpegts container for HLS videos. This is default when not downloading live streams
--downloader [PROTO:]NAME Name or path of the external downloader to use (optionally) prefixed by the protocols (http, ftp, m3u8, dash, rstp, rtmp, mms) to use it for. Currently supports native, aria2c, avconv, axel, curl, ffmpeg, httpie, wget (Recommended: aria2c). You can use this option multiple times to set different downloaders for different protocols. For example, --downloader aria2c --downloader "dash,m3u8:native" will use aria2c for http/ftp downloads, and the native downloader for dash/m3u8 downloads--downloader-args NAME:ARGS Give these arguments to the external downloader. Specify the downloader name and the arguments separated by a colon ":". For ffmpeg, arguments can be passed to different positions using the same syntax as --postprocessor-args. You can use this option multiple times to give different arguments to different downloaders
Filesystem
-a, --batch-file FILEFile containing URLs to download (‘-’ for stdin), one URL per line. Lines starting with#,;or]are considered as comments and ignored
-P, --paths [TYPES:]PATHThe paths where the files should be downloaded. Specify the type of file and the path separated by a colon ":". All the same types as -- utput are supported. Additionally, you can also provide "home" (default) and "temp" paths. All intermediary files are first downloaded to the temp path and then the final files are moved over to the home path after download is finished. This option is ignored if --output is an absolute path
-o, --output [TYPES:]TEMPLATEOutput filename template; see "OUTPUT TEMPLATE" for details
--restrict-filenames Restrict filenames to only ASCII characters, and avoid "&" and spaces in filenames
--windows-filenames Force filenames to be windows compatible
--trim-filenames LENGTH Limit the filename length (sans extension) to the specified number of characters
-w, --no-overwrites Do not overwrite any files
--force-overwrites Overwrite all video and metadata files.
--no-continue Do not resume partially downloaded fragments. If the file is not fragmented, restart download of the entire file
--no-part Do not use .part files - write directly into output file
--no-mtime Do not use the Last-modified header to set the file modification time
--write-description Write video description to a .description file
--write-info-json Write video metadata to a .info.json file (this may contain personal information)
--no-clean-infojson Write all fields to the infojson
--write-comments Retrieve video comments to be placed in the infojson. The comments are fetched even without this option if the extraction is known to be quick--no-write-comments Do not retrieve video comments unless the extraction is known to be quick
--load-info-json FILE JSON file containing the video information (created with the "--write-info-json" option)
--cookies FILE File to read cookies from and dump cookie jar in
--cookies-from-browser BROWSER[:PROFILE] Load cookies from a user profile of the given web browser. Currently supported browsers are: brave, chrome, chromium, edge, firefox, opera, safari, vivaldi. You can specify the user profile name or directory using "BROWSER:PROFILE_NAME" or "BROWSER:PROFILE_PATH". If no profile is given, the most recently accessed one is used
--cache-dir DIR Location in the filesystem where youtube-dl can store some downloaded information (such as client ids and signatures) permanently. By default $XDG_CACHE_HOME/yt-dlp or ~/.cache/yt-dlp
--no-cache-dir Disable filesystem caching
--rm-cache-dir Delete all filesystem cache filesThumbnail
--write-thumbnail Write thumbnail image to disk
--write-all-thumbnails Write all thumbnail image formats to disk
--list-thumbnails List available thumbnails of each video. Simulate unless --no-simulate is usedVerbosity and Simulation
-q, --quietActivate quiet mode. If used with--verbose, print the log to stderr
--no-warningsIgnore warnings
-s, --simulateDo not download the video and do not write anything to disk
--no-simulateDownload the video even if printing/listing options are used
--ignore-no-formats-errorIgnore "No video formats" error. Usefull for extracting metadata even if the videos are not actually available for download (experimental)
--no-ignore-no-formats-errorThrow error when no downloadable video formats are found (default)
--skip-downloadDo not download the video but write all related files
-O, --print TEMPLATEQuiet, but print the given fields for each video. Simulate unless --no-simulate is used. Either a field name or same syntax as the output template can be used
-j, --dump-jsonQuiet, but print JSON for each video. Simulate. See "OUTPUT TEMPLATE" for a description of available keys
-J, --dump-single-jsonQuiet, but print JSON for each url or infojson passed. Simulate. If the URL refers to a playlist, the whole playlist information is dumped in a single line
--force-write-archiveForce download archive entries to be written as far as no errors occur, even if -s or another simulation option is used
--newlineOutput progress bar as new lines
--no-progressDo not print progress bar
--progressShow progress bar, even if in quiet mode
--console-titleDisplay progress in console titlebar
--progress-template [TYPES:]TEMPLATETemplate for progress outputs, optionally prefixed with one of "download:" (default), "download-title:" (the console title), "postprocess:", or "postprocess-title:". The video’s fields are accessible under the "info" key and the progress attributes are accessible under "progress" key. Eg: --console-title --progress-template "download-title:%(info.id)s-%(progress.eta)s"-v, --verbosePrint various debugging information
--dump-pagesPrint downloaded pages encoded using base64 to debug problems (very verbose)
--write-pagesWrite downloaded intermediary pages to files in the current directory to debug problems
--print-trafficDisplay sent and read HTTP trafficWorkarounds
--no-check-certificateSuppress HTTPS certificate validation--prefer-insecureUse an unencrypted connection to retrieve information about the video (Currently supported only for YouTube)--user-agent UASpecify a custom user agent--referer URLSpecify a custom referer, use if the video access is restricted to one domain--add-header FIELD:VALUESpecify a custom HTTP header and its value, separated by a colon ":". You can use this option multiple times --sleep-requests SECONDS Number of seconds to sleep between requests during data extraction--sleep-interval SECONDSNumber of seconds to sleep before each download. This is the minimum time to sleep when used along with --max-sleep-interval (Alias: --min-sleep-interval)--max-sleep-interval SECONDSMaximum number of seconds to sleep. Can only be used along with --min-sleep-interval--sleep-subtitles SECONDSNumber of seconds to sleep before each subtitle downloadVideo Format
-f, --format FORMATVideo format code, see "FORMAT SELECTION" for more details-S, --format-sort SORTORDERSort the formats by the fields given, see "Sorting Formats" for more details--S-force, --format-sort-forceForce user specified sort order to have precedence over all fields, see "Sorting Formats" for more details--video-multistreamsAllow multiple video streams to be merged into a single file--audio-multistreamsAllow multiple audio streams to be merged into a single file--prefer-free-formatsPrefer formats with free containers over non-free ones of same quality. Use with "-S ext" to strictly prefer free containers irrespective of quality--check-formatsCheck that the formats selected are actually downloadable--no-check-formatsDo not check that the formats selected are actually downloadable-F, --list-formatsList available formats of each video. Simulate unless --no-simulate is used--merge-output-format FORMATIf a merge is required (e.g. bestvideo+bestaudio), output to given container format. One of mkv, mp4, ogg, webm, flv. Ignored if no merge is requiredSous-titres
--write-subsWrite subtitle file--write-auto-subsWrite automatically generated subtitle file--list-subsListe des sous-titres disponibles. Simulate.--sub-format FORMATFormat des sous-titres (srt|ass/srt/best)--sub-langs LANGSLanguages séparés par une virgule (en,fr)Post-Process
-x, --extract-audioConvert video files to audio-only files (requires ffmpeg and ffprobe)--audio-format FORMATSpecify audio format to convert the audio to when -x is used. Currently supported formats are: best (default) or one of best|aac|flac|mp3|m4a|opus|vorbis|wav--audio-quality QUALITYSpecify ffmpeg audio quality, insert a value between 0 (better) and 9 (worse) for VBR or a specific bitrate like 128K (default 5)--remux-video FORMATRemux the video into another container if necessary (currently supported: mp4|mkv|flv |webm|mov|avi|mp3|mka|m4a|ogg|opus). If target container does not support the video/audio codec, remuxing will fail. You can specify multiple rules; Eg. "aac>m4a/mov>mp4/mkv" will remux aac to m4a, mov to mp4 and anything else to mkv.--recode-video FORMATRe-encode the video into another format if re-encoding is necessary. La syntaxe et les formats sont identiques à --remux-video--postprocessor-args NAME:ARGSGive these arguments to the postprocessors name and the arguments separated by a colon ":" to give the argument to the specified postprocessor/executable. Supported PP are: Merger, ModifyChapters, SplitChapters, ExtractAudio, VideoRemuxer, VideoConvertor, Metadata, EmbedSubtitle, EmbedThumbnail, SubtitlesConvertor, ThumbnailsConvertor, FixupStretched, FixupM4a, FixupM3u8, FixupTimestamp and FixupDuration. The supported executables are: AtomicParsley, FFmpeg and FFprobe. You can also specify "PP+EXE:ARGS" to give the arguments to the specified executable only when being used by the specified postprocessor.Additionally, for ffmpeg/ffprobe, "_i"/"_o" can be appended to the prefix optionally followed by a number to pass the argument before the specified input/output file. Eg: --ppa "Merger+ffmpeg_i1:-v quiet". You can use this option multiple times to give different arguments to different postprocessors. (Alias: --ppa)
-k, --keep-videoKeep the intermediate video file on disk after post-processing--no-post-overwrites Do not overwrite post-processed files
--embed-subs Embed subtitles in the video (only for mp4, webm and mkv videos)
--embed-thumbnail Embed thumbnail in the video as cover art
--embed-metadata Embed metadata to the video file. Also adds chapters to file unless --no-add-chapters is used (Alias: --add-metadata)
--embed-chaptersAdd chapter markers to the video file--parse-metadata FROM:TO Parse additional metadata like title/artist from other fields; see "MODIFYING METADATA" for details
--replace-in-metadata FIELDS REGEX REPLACE Replace text in a metadata field using the given regex. This option can be used multiple times
--xattrs Write metadata to the video file’s xattrs (using dublin core and xdg standards)
--fixup POLICYAutomatically correct known faults of the file. One of never (do nothing), warn (only emit a warning), detect_or_warn (the default; fix file if we can, warn otherwise), force (try fixing even if file already exists--ffmpeg-location PATHLocation of the ffmpeg binary; either the path to the binary or its containing directory--exec CMDExecute a command on the file after downloading and post-processing. Same syntax as the output template can be used to pass any field as arguments to the command. An additional field "filepath" that contains the final path of the downloaded file is also available. If no fields are passed, %(filepath)q is appended to the end of the command. This option can be used multiple times--no-execRemove any previously defined --exec--exec-before-download CMD Execute a command before the actual download. The syntax is the same as --execbut "filepath" is not available. This option can be used multiple times
--no-exec-before-download Remove any previously defined --exec-before-download
--convert-subs FORMAT Convert the subtitles to another format (currently supported: srt|vtt|ass|lrc) (Alias: --convert-subtitles)
--convert-thumbnails FORMAT Convert the thumbnails to another format (currently supported: jpg|png)
--split-chapters Split video into multiple files based on internal chapters. The "chapter:" prefix can be used with "--paths" and "--output" to set the output filename for the split files. See "OUTPUT TEMPLATE" for details
--remove-chapters REGEX Remove chapters whose title matches the given regular expression. Time ranges prefixed by a "*" can also be used in place of chapters to remove the specified range. Eg: --remove-chapters "*10:15-15:00″
--remove-chapters "intro". This option can be used multiple times
--force-keyframes-at-cuts Force keyframes around the chapters before removing/splitting them. Requires a reencode and thus is very slow, but the resulting video may have fewer artifacts around the cuts
--no-force-keyframes-at-cuts Do not force keyframes around the chapters when cutting/splitting (default)
--use-postprocessor NAME[:ARGS] The (case sensitive) name of plugin postprocessors to be enabled, and (optionally) arguments to be passed to it, seperated by a colon ":". ARGS are a semicolon ";" delimited list of NAME=VALUE.
The "when" argument determines when the postprocessor is invoked. It can be one of "pre_process" (after extraction), "before_dl" (before video download), "post_process" (after video download; default) or "after_move" (after moving file to their final locations). This option can be used multiple times to add different postprocessors
SponsorBlock
Make chapter entries for, or remove various segments (sponsor, introductions, etc.) from downloaded YouTube videos using the SponsorBlock API
--sponsorblock-mark CATSSponsorBlock categories to create chapters for, separated by commas. Available categories are all, sponsor, intro, outro, selfpromo, interaction, preview, music_offtopic. You can prefix the category with a "-" to exempt it. See https://wiki.sponsor.ajay.app/index.php/Segment_Categories for description of the categories. Eg: --sponsorblock-query all,-preview --sponsorblock-remove CATS SponsorBlock categories to be removed from the video file, separated by commas. If a category is present in both mark and remove, remove takes precedence. The syntax and available categories are the same as for --sponsorblock-mark--sponsorblock-chapter-title TEMPLATEThe title template for SponsorBlock chapters created by --sponsorblock-mark. The same syntax as the output template is used, but the only available fields are start_time, end_time, category, categories, name, category_names. Defaults to "[SponsorBlock]: %(category_names)l"--no-sponsorblock Disable both --sponsorblock-mark and --sponsorblock-remove
--sponsorblock-api URL SponsorBlock API location, defaults to https://sponsor.ajay.app
Extractor
--extractor-retries RETRIESNumber of retries for known extractor errors (default is 3), or "infinite"--allow-dynamic-mpdProcess dynamic DASH manifests (default) (Alias: --no-ignore-dynamic-mpd)--ignore-dynamic-mpdDo not process dynamic DASH manifests (Alias: --no-allow-dynamic-mpd)--hls-split-discontinuitySplit HLS playlists to different formats at discontinuities such as ad breaks--no-hls-split-discontinuityDo not split HLS playlists to different formats at discontinuities such as ad breaks (default)--extractor-args KEY:ARGSPass these arguments to the extractor.See "EXTRACTOR ARGUMENTS" for details. You can use this option multiple times to give arguments for different extractors
CONFIGURATION
Place any supported command line option to a configuration file. The configuration is loaded from the following locations:
- Main Configuration: The file given by
--config-location- Portable Configuration:
yt-dlp.confin the same directory as the bundled binary. If you are running from source-code (<root dir>/yt_dlp/__main__.py), the root directory is used instead.- Home Configuration:
yt-dlp.confin the home path given by-P "home:<path>", or in the current directory if no such path is given- User Configuration:
%XDG_CONFIG_HOME%/yt-dlp/config(recommended on Linux/macOS)%XDG_CONFIG_HOME%/yt-dlp.conf~/yt-dlp.conf~/yt-dlp.conf.txt%XDG_CONFIG_HOME%defaults to~/.configif undefined. On windows,~points to %HOME% if present,%USERPROFILE%(generallyC:\Users\<user name>) or%HOMEDRIVE%%HOMEPATH%.- System Configuration:
/etc/yt-dlp.confFor example, with the following configuration file yt-dlp will always extract the audio, not copy the mtime, use a proxy and save all videos under
YouTubedirectory in your home directory:# Lines starting with # are comments -x # Always extract audio --no-mtime # Do not copy the mtime --proxy 127.0.0.1:3128 # Use this proxy -o ~/YouTube/%(title)s.%(ext)s # Save videos under YouTube directory in your home directory
Note that options in configuration file are just the same options aka switches used in regular command line calls; thus there must be no whitespace after
-or--, e.g.-oor--proxybut not- oor-- proxy.You can use
--ignore-configif you want to disable all configuration files for a particular yt-dlp run. If--ignore-configis found inside any configuration file, no further configuration will be loaded. For example, having the option in the portable configuration file prevents loading of user and system configurations. Additionally, (for backward compatibility) if--ignore-configis found inside the system configuration file, the user configuration is not loaded.Authentication with
.netrcfileYou may also want to configure automatic credentials storage for extractors that support authentication (by providing login and password with
--usernameand--password) in order not to pass credentials as command line arguments on every yt-dlp execution and prevent tracking plain text passwords in the shell command history. You can achieve this using a.netrcfile on a per extractor basis. For that you will need to create a.netrcfile in--netrc-locationand restrict permissions to read/write by only you:touch $HOME/.netrc chmod a-rwx,u+rw $HOME/.netrc
After that you can add credentials for an extractor in the following format, where extractor is the name of the extractor in lowercase:
machine <extractor> login <username> password <password>
For example:
machine youtube login myaccount@gmail.com password my_youtube_password machine twitch login my_twitch_account_name password my_twitch_password
To activate authentication with the
.netrcfile you should pass--netrcto yt-dlp or place it in the configuration file.The default location of the .netrc file is
$HOME(~) in UNIX. On Windows, it is%HOME%if present,%USERPROFILE%(generallyC:\Users\<user name>) or%HOMEDRIVE%%HOMEPATH%Nom du fichier (output template)
-oa template for the output file names while-Poption is used to specify the path each type of file should be saved to.The special sequences may be formatted according to python string formatting operations. For example,
%(NAME)sor%(NAME)05d.- Object traversal: The dictionaries and lists available in metadata can be traversed by using a
.(dot) separator. You can also do python slicing using:. Eg:%(tags.0)s,%(subtitles.en.-1.ext)s,%(id.3:7:-1)s,%(formats.:.format_id)s.%()srefers to the entire infodict. Use-jto see such fields- Addition: Addition and subtraction of numeric fields can be done using
+and-respectively. Eg:%(playlist_index+10)03d,%(n_entries+1-playlist_index)d- Date/time Formatting: Date/time fields can be formatted according to strftime formatting by specifying it separated from the field name using a
>. Eg:%(duration>%H-%M-%S)s,%(upload_date>%Y-%m-%d)s,%(epoch-3600>%H-%M-%S)s- Alternatives: Alternate fields can be specified seperated with a
,. Eg:%(release_date>%Y,upload_date>%Y|Unknown)s- Default: A literal default value can be specified for when the field is empty using a
|seperator. This overrides--output-na-template. Eg:%(uploader|Unknown)s- More Conversions: In addition to the normal format types
diouxXeEfFgGcrs,B,j,l,qcan be used for converting to Bytes, json, a comma seperated list (alternate form flag#makes it new line\nseperated) and a string quoted for the terminal, respectively- Unicode normalization: The format type
Ucan be used for NFC unicode normalization. The alternate form flag (#) changes the normalization to NFD and the conversion flag+can be used for NFKC/NFKD compatibility equivalence normalization. Eg:%(title)+.100Uis NFKCTo summarize, the general syntax for a field is:
%(name[.keys][addition][>strf][,alternate][|default])[flags][width][.precision][length]type
You can set different templates for various metadata files separately from the general template by specifying the type of file followed by the template separated by a colon
:.The different file types supported are
subtitle,thumbnail,description,annotation(deprecated),infojson,pl_thumbnail,pl_description,pl_infojson,chapter. For example,-o ‘%(title)s.%(ext)s’ -o ‘thumbnail:%(title)s\%(title)s.%(ext)s’will put the thumbnails in a folder with the same name as the video. If any of the templates (except default) is empty, that type of file will not be written. Eg:--write-thumbnail -o "thumbnail:"will write thumbnails only for playlists and not for video.The available fields are:
Type string :
id-title-url-ext-alt_title-description-display_id: An alternative identifier for the video -uploader: Nom du uploader -license: Nom de la license -creator: Créateur -uploader_id: Nickname or id of the video uploader -channel: Full name of the channel -channel_id-location: Physical location where the video was filmed-duration_string: HH:mm:ss -live_status: ‘is_live’, ‘was_live’, ‘is_upcoming’, ‘not_live’ -playable_in_embed: is allowed to play in embedded players on other sites -availability: ‘private’, ‘premium_only’, ‘subscriber_only’, ‘needs_auth’, ‘unlisted’, ‘public’ -format: human-readable of the format -format_id-format_note: Additional info about the format -acodec: audio codec -resolution: Textual description of width and height -protocol: The protocol that will be used for the actual download -extractor: Name of the extractor -extractor_key: Key name of the extractor -dynamic_range: The dynamic range of the video -vcodec: Name of the video codec in use -container: Name of the container format -playlist: Name or id of the playlist that contains the video -playlist_id-playlist_title: Playlist title -playlist_uploader: Full name of the playlist uploader -playlist_uploader_id: Nickname or id of the playlist uploader -webpage_url-original_urlType integer :
timestamp: UNIX timestamp of the moment the video became available -release_timestamp: UNIX timestamp of the moment the video was released-duration: en secondes -view_count-like_count-dislike_count: Number of negative ratings of the video -repost_count: Number of reposts of the video -average_rating: Average rating give by users, the scale used depends on the webpage -comment_count: Nbre de commentaires -age_limit: Age restriction for the video (years) -start_time: Time in seconds where the reproduction should start, as specified in the URL -end_time: Time in seconds where the reproduction should end, as specified in the URL -width-height-tbr: Average bitrate of audio and video in KBit/s -abr: Average audio bitrate in KBit/s -asr: Audio sampling rate in Hertz -vbr: Average video bitrate in KBit/s -fps: Frame rate -filesize: Nbre de bytes, if known in advance -filesize_approx: Estimation du nbre de bytes -epoch: Unix epoch when creating the file -autonumber: Number that will be increased with each download, starting at--autonumber-start-n_entries: Total number of extracted items in the playlist -playlist_index: Index of the video in the playlist padded with leading zeros according the final index -playlist_autonumber: Position of the video in the playlist download queue padded with leading zeros according to the total length of the playlistType date :
upload_date: Video upload date (YYYYMMDD) -release_date: The date (YYYYMMDD) when the video was releasedBooléen :
is_live: If the video is a live stream or a fixed-length video -was_live: If the video was originally a live streamChapitre ou Section :
chapter: Name or title of the chapter -chapter_number: Number of the chapter -chapter_idAvailable for
chapter:prefix when using--split-chaptersfor videos with internal chapters:-
section_title: Title of the chapter -section_number: Number of the chapter within the file -section_start(num): Start time of the chapter in seconds -section_end(num): End time of the chapter in secondsSérie:
series: Title of the series or programme-
season: Title of the season -season_number: Number of the season -season_id: Id of the season-
episode: Title of the episode -episode_number: Number of the episode within a season -episode_id: Id of the episodeUne piste d’un Album :
track: Title -track_number-track_id-artist: Artist(s) -genre: Genre(s) -album: Titre de l’album -album_type-album_artist: List of all artists appeared -disc_number-release_year: Year (YYYY)Available only when used in
--print:-
urls: The URLs of all requested formats, one in each line-
filename: Name of the video file. Note that the actual filename may be different due to post-processing. Use--exec echoto get the name after all postprocessing is completeAvailable only in --sponsorblock-chapter-title:
start_time(numeric): Start time of the chapter in seconds -end_time(numeric): End time of the chapter in seconds -categories(list): The SponsorBlock categories the chapter belongs to -category(string): The smallest SponsorBlock category the chapter belongs to -category_names(list): Friendly names of the categories -name(string): Friendly name of the smallest category-o %(title)s-%(id)s.%(ext)s>Test video-BaW_jenozKc.mp4file created in the current directory.Look at the
-joutput to identify which fields are available for the purticular URLNumeric sequences:
%(view_count)05d->00042.-o ‘%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s‘-> chaque video in a directory corresponding to this path template.Utiliser le signe % >
%%.Output to stdout >
-o -.Par défaut :
%(title)s [%(id)s].%(ext)s.--restrict-filenamespour enlever les caractères non unicode:yt-dlp --get-filename -o '%(title)s.%(ext)s' BaW_jenozKc youtube-dl test video ''_ä↭
PLAYLIST
--playlist-start NUMBERPlaylist video to start at (default is 1)
--playlist-end NUMBERPlaylist video to end at (default is last)
-I,--playlist-items ITEMListe des vidéos désirées (par index), séparées par des virgules.-I 1,2,5,8pour ne télécharger ques les vidéos 1, 2, 5, 8-I 1-3,7,10-13pour les vidéos 1 à 3, 7 et 10 à 13START:STOP:STEP(si indices négatifs, comptera depuis la droite. Si STEP négatif, téléchargera en ordre inverse.-I 1:3,7,‐5::2Si playlist de 15 vidéos, sélectionnera les vidéos 1,2,3,7,11,13,15Télécharger la Playlist dans
~/Downloads/titre_playlist/où les noms commencent par 01, 02, etc.-o '~/Downloads/%(playlist)s/%(playlist_index)02d - %(title)s.%(ext)s'
Avoir des infos sur la Playlist :
import yt_dlp url_playlist = "https://www.youtube.com/playlist?list=XXX" ydl_opts = { 'quiet': True, # no console output 'no_warnings': True, 'playlistend': 0, } with yt_dlp.YoutubeDL(ydl_opts) as ydl: meta = ydl.extract_info(url_playlist, download=False) print(f"title: {meta['title']}") print(f"playlist_count: {meta['playlist_count']}") print(f"id: {meta['id']}") print(f"availability: {meta['availability']}") print(f"description: {meta['description']}") print(f"modified_date: {meta['modified_date']}") print(f"view_count: {meta['view_count']}") print(f"channel: {meta['channel']}") print(f"channel_id: {meta['channel_id']}") print(f"uploader_id: {meta['uploader_id']}") print(f"uploader: {meta['uploader']}") print(f"channel_url: {meta['channel_url']}") print(f"uploader_url: {meta['uploader_url']}") print(f"_type: {meta['_type']}")