• 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-errors The download will be considered successfull even if the postprocessing fails
      --abort-on-error Abort downloading of further videos if an error occurs
      --dump-user-agent Display the current user-agent and exit
      --list-extractors List all supported extractors and exit
      --extractor-descriptions Output descriptions of all supported extractors and exit
      --force-generic-extractor Force extraction to use the generic extractor
      --default-search PREFIX Use 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 PATH Location of the main configuration file; either the path to the config or its containing directory
      --flat-playlist Do not extract the videos of a playlist, only list them
      --no-flat-playlist Extract the videos of a playlist
      --mark-watched Mark videos watched (even with --simulate). Currently only supported for YouTube
      --no-colors Do not emit color codes in output
      --compat-options OPTS Options 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 details

      Vidéo Sélection

      --max-downloads NUMBER Abort after downloading NUMBER files
      --min-filesize SIZE Do not download any videos smaller than SIZE (e.g. 50k or 44.6m)
      --max-filesize SIZE Do not download any videos larger than SIZE (e.g. 50k or 44.6m)
      --date DATE only videos uploaded in this date. The date can be "YYYYMMDD" or in the format "(now|today)[+-][0-9](day|week|month|year)(s)?"
      --datebefore DATE Download only videos uploaded on or before this date. Format identique à --date
      --dateafter DATE Download only videos uploaded on or after this date. Format identique à --date
      --match-filter FILTER Generic 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 YEARS Download only videos suitable for the given age
      --download-archive FILE Download 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 N Number of allowed failures until the rest of the playlist is skipped

      Download

      -N, --concurrent-fragments N Number 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 FILE File containing URLs to download (‘-’ for stdin), one URL per line. Lines starting with #, ; or ] are considered as comments and ignored
      -P, --paths [TYPES:]PATH The 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:]TEMPLATE Output 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 files

      Thumbnail

      --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 used

      Verbosity and Simulation

      -q, --quiet Activate quiet mode. If used with --verbose, print the log to stderr
      --no-warnings Ignore warnings
      -s, --simulate Do not download the video and do not write anything to disk
      --no-simulate Download the video even if printing/listing options are used
      --ignore-no-formats-error Ignore "No video formats" error. Usefull for extracting metadata even if the videos are not actually available for download (experimental)
      --no-ignore-no-formats-error Throw error when no downloadable video formats are found (default)
      --skip-download Do not download the video but write all related files
      -O, --print TEMPLATE Quiet, 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-json Quiet, but print JSON for each video. Simulate. See "OUTPUT TEMPLATE" for a description of available keys
      -J, --dump-single-json Quiet, 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-archive Force download archive entries to be written as far as no errors occur, even if -s or another simulation option is used
      --newline Output progress bar as new lines
      --no-progress Do not print progress bar
      --progress Show progress bar, even if in quiet mode
      --console-title Display progress in console titlebar
      --progress-template [TYPES:]TEMPLATE Template 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, --verbose Print various debugging information
      --dump-pages Print downloaded pages encoded using base64 to debug problems (very verbose)
      --write-pages Write downloaded intermediary pages to files in the current directory to debug problems
      --print-traffic Display sent and read HTTP traffic

      Workarounds

      --no-check-certificate Suppress HTTPS certificate validation

      --prefer-insecure Use an unencrypted connection to retrieve information about the video (Currently supported only for YouTube)

      --user-agent UA Specify a custom user agent

      --referer URL Specify a custom referer, use if the video access is restricted to one domain

      --add-header FIELD:VALUE Specify 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 SECONDS Number 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 SECONDS Maximum number of seconds to sleep. Can only be used along with --min-sleep-interval

      --sleep-subtitles SECONDS Number of seconds to sleep before each subtitle download

      Video Format

      -f, --format FORMAT Video format code, see "FORMAT SELECTION" for more details

      -S, --format-sort SORTORDER Sort the formats by the fields given, see "Sorting Formats" for more details

      --S-force, --format-sort-force Force user specified sort order to have precedence over all fields, see "Sorting Formats" for more details

      --video-multistreams Allow multiple video streams to be merged into a single file

      --audio-multistreams Allow multiple audio streams to be merged into a single file

      --prefer-free-formats Prefer formats with free containers over non-free ones of same quality. Use with "-S ext" to strictly prefer free containers irrespective of quality

      --check-formats Check that the formats selected are actually downloadable

      --no-check-formats Do not check that the formats selected are actually downloadable

      -F, --list-formats List available formats of each video. Simulate unless --no-simulate is used

      --merge-output-format FORMAT If 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 required

      Sous-titres

      --write-subs Write subtitle file

      --write-auto-subs Write automatically generated subtitle file

      --list-subs Liste des sous-titres disponibles. Simulate.

      --sub-format FORMAT Format des sous-titres (srt | ass/srt/best)

      --sub-langs LANGS Languages séparés par une virgule (en,fr)

      Post-Process

      -x, --extract-audio Convert video files to audio-only files (requires ffmpeg and ffprobe)

      --audio-format FORMAT Specify 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 QUALITY Specify ffmpeg audio quality, insert a value between 0 (better) and 9 (worse) for VBR or a specific bitrate like 128K (default 5)

      --remux-video FORMAT Remux 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 FORMAT Re-encode the video into another format if re-encoding is necessary. La syntaxe et les formats sont identiques à --remux-video

      --postprocessor-args NAME:ARGS Give 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-video Keep 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-chapters Add 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 POLICY Automatically 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 PATH Location of the ffmpeg binary; either the path to the binary or its containing directory

      --exec CMD Execute 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-exec Remove 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 CATS SponsorBlock 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 TEMPLATE The 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 RETRIES Number of retries for known extractor errors (default is 3), or "infinite"

      --allow-dynamic-mpd Process dynamic DASH manifests (default) (Alias: --no-ignore-dynamic-mpd)

      --ignore-dynamic-mpd Do not process dynamic DASH manifests (Alias: --no-allow-dynamic-mpd)

      --hls-split-discontinuity Split HLS playlists to different formats at discontinuities such as ad breaks

      --no-hls-split-discontinuity Do not split HLS playlists to different formats at discontinuities such as ad breaks (default)

      --extractor-args KEY:ARGS Pass 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.conf in 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.conf in 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 ~/.config if undefined. On windows, ~ points to %HOME% if present, %USERPROFILE% (generally C:\Users\<user name>) or %HOMEDRIVE%%HOMEPATH%.

      - System Configuration: /etc/yt-dlp.conf

      For 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 YouTube directory 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. -o or --proxy but not - o or -- proxy.

      You can use --ignore-config if you want to disable all configuration files for a particular yt-dlp run. If --ignore-config is 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-config is found inside the system configuration file, the user configuration is not loaded.

      Authentication with .netrc file

      You may also want to configure automatic credentials storage for extractors that support authentication (by providing login and password with --username and --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 .netrc file on a per extractor basis. For that you will need to create a .netrc file in --netrc-location and 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 .netrc file you should pass --netrc to 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% (generally C:\Users\<user name>) or %HOMEDRIVE%%HOMEPATH%

      Nom du fichier (output template)

      -o a template for the output file names while -P option 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)s or %(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%()s refers to the entire infodict. Use -j to 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 diouxXeEfFgGcrsBjlq can be used for converting to Bytes, json, a comma seperated list (alternate form flag # makes it new line \n seperated) and a string quoted for the terminal, respectively

      - Unicode normalization: The format type U can 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)+.100U is NFKC

      To 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 subtitlethumbnaildescriptionannotation (deprecated), infojsonpl_thumbnail, pl_descriptionpl_infojsonchapter. 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_url

       

      Type 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 playlist

       

      Type date :upload_date: Video upload date (YYYYMMDD) - release_date: The date (YYYYMMDD) when the video was released

       

      Booléen : is_live: If the video is a live stream or a fixed-length video - was_live: If the video was originally a live stream

       

      Chapitre ou Section : chapter: Name or title of the chapter - chapter_number: Number of the chapter - chapter_id

      Available for chapter: prefix when using --split-chapters for 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 seconds

       

       

      Sé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 episode

       

      Une 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 echo to get the name after all postprocessing is complete

       

      Available 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.mp4 file created in the current directory.

      Look at the -j output to identify which fields are available for the purticular URL

      Numeric 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-filenames pour enlever les caractères non unicode:

      yt-dlp --get-filename -o '%(title)s.%(ext)s' BaW_jenozKc
      youtube-dl test video ''_ä↭

      PLAYLIST

      --playlist-start NUMBER Playlist video to start at (default is 1)
      --playlist-end NUMBER Playlist video to end at (default is last)
      -I, --playlist-items ITEM Liste des vidéos désirées (par index), séparées par des virgules.

      -I 1,2,5,8 pour ne télécharger ques les vidéos 1, 2, 5, 8

      -I 1-3,7,10-13 pour les vidéos 1 à 3, 7 et 10 à 13

      START: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::2 Si playlist de 15 vidéos, sélectionnera les vidéos 1,2,3,7,11,13,15

       

      Té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']}")

 

Aucun commentaire

 

Laissez un commentaire