id = "youtube-dl" name = "youtube-dl" homepage = "https://ytdl-org.github.io/youtube-dl/" description = "A command-line program to download videos from YouTube.com and a few more sites." executables = ["youtube-dl"] [dotfiles] # README, CONFIGURATION section (github.com/ytdl-org/youtube-dl): the per-user # file is ~/.config/youtube-dl/config on Linux and macOS, and on Windows either # %APPDATA%\youtube-dl\config.txt or youtube-dl.conf in the user profile root. # The last one resolves to the same place a consumer computes for ~/, so it is # spelled with ~ rather than %USERPROFILE%. /etc/youtube-dl.conf is # system-wide, not user-level, and is not listed. paths = [ "~/.config/youtube-dl/config", "~/youtube-dl.conf", "%APPDATA%/youtube-dl/config.txt", ] # --cache-dir defaults to $XDG_CACHE_HOME/youtube-dl (README, options), which # is `[xdgCache]`: youtube_dl/cache.py takes # `compat_getenv('XDG_CACHE_HOME', '~/.cache')` with no per-platform branch, # so the dot path is what it uses on macOS and Windows as well, and the # variable moves it everywhere. exclude = ["[xdgCache]/youtube-dl/"] # Login details go through --netrc and ~/.netrc, which is not youtube-dl's # own file. Nothing the config file holds is a credential by itself. secret = [] # The options file is re-read on every invocation. side_effect = false # One file under three names, so both rules name all three — the sibling check # pairs paths by their last segment and cannot see that config, config.txt and # youtube-dl.conf are the same thing. The file is a list of command-line # options, one per line. # # --cache-dir is a directory the user picked and --cookies points at a jar that # exists only here: both are worth keeping so they can rebuild this machine, # and worth nothing on another. [[dotfiles.machine_lines]] file = [ "~/.config/youtube-dl/config", "~/youtube-dl.conf", "%APPDATA%/youtube-dl/config.txt", ] match = { prefix = ["--cache-dir", "--cookies"] } scope = "backup" # --ffmpeg-location is where ffmpeg was installed, which follows from the OS # and the architecture rather than from this box — hence its own rule, and a # value shared across that machine class. [[dotfiles.machine_lines]] file = [ "~/.config/youtube-dl/config", "~/youtube-dl.conf", "%APPDATA%/youtube-dl/config.txt", ] match = { prefix = ["--ffmpeg-location"] } scope = "platform" [commands] format = 1 label = "Download video" description = "Download videos and audio from a URL. Authentication, proxy, geo-bypass and post-processing details are mostly left out." quality = "ai-draft" base = "fig:youtube-dl" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = true } [[commands.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/youtube-dl.ts" license = "MIT" [[commands.field]] id = "urls" label = "URLs" type = "url" position = 0 multiple = true sources = ["fig"] [[commands.field]] id = "format" label = "Format code" type = "string" option = ["--format", "-f"] suggestions = [{ value = "bestvideo+bestaudio", label = "Best video + audio" }, { value = "best", label = "Best single file" }] sources = ["fig"] [[commands.field]] id = "list_formats" label = "List formats only" type = "boolean" option = ["--list-formats", "-F"] sources = ["fig"] [[commands.field]] id = "extract_audio" label = "Extract audio" type = "boolean" option = ["--extract-audio", "-x"] sources = ["fig"] [[commands.field]] id = "audio_format" label = "Audio format" type = "string" option = ["--audio-format"] suggestions = [{ value = "mp3", label = "MP3" }, { value = "m4a", label = "M4A" }, { value = "opus", label = "Opus" }, { value = "flac", label = "FLAC" }, { value = "wav", label = "WAV" }, { value = "best", label = "Best" }] sources = ["fig"] [[commands.field]] id = "output" label = "Output template" type = "string" option = ["--output", "-o"] sources = ["fig"] [[commands.field]] id = "no_playlist" label = "Single video only" type = "boolean" option = ["--no-playlist"] sources = ["fig"] [[commands.field]] id = "write_sub" label = "Write subtitles" type = "boolean" option = ["--write-sub"] sources = ["fig"] [[commands.field]] id = "embed_thumbnail" label = "Embed thumbnail" type = "boolean" option = ["--embed-thumbnail"] sources = ["fig"] [[commands.field]] id = "limit_rate" label = "Rate limit" type = "string" option = ["--limit-rate", "-r"] sources = ["fig"] [[commands.field]] id = "cookies" label = "Cookies file" type = "path" option = ["--cookies"] path = { kind = "file", role = "input", must_exist = true } sources = ["fig"] [[commands.field]] id = "simulate" label = "Simulate only" type = "boolean" option = ["--simulate", "-s"] sources = ["fig"] [[commands.task]] id = "video" label = "Download video" fields = ["urls", "format", "output", "no_playlist"] required = ["urls"] [[commands.task]] id = "audio" label = "Download audio" set = { extract_audio = [true] } lock = ["extract_audio"] fields = ["urls", "audio_format", "output", "no_playlist"] required = ["urls"] [[commands.task]] id = "formats" label = "List formats" set = { list_formats = [true] } lock = ["list_formats"] fields = ["urls"] required = ["urls"] [[commands.group]] id = "basic" label = "Basic" fields = ["urls", "format", "extract_audio", "audio_format", "output", "no_playlist"] [[commands.group]] id = "advanced" label = "Advanced" fields = ["list_formats", "write_sub", "embed_thumbnail", "limit_rate", "cookies", "simulate"]