yt-dlp 是一个 youtube-dl 分支,基于现在不活跃的 youtube-dlc。该项目的主要重点是添加新功能和补丁,同时与原始项目保持同步
从 yt-dlc@f9401f2 分叉并与 youtube-dl@be008e6 合并(例外)
SponsorBlock 集成:你可以使用 SponsorBlock API 标记/删除 YouTube 视频中的赞助商部分
格式排序:默认格式排序选项已更改,因此现在将首选更高的分辨率和更好的编解码器,而不是简单地使用更大的比特率。此外,你现在可以使用 指定排序顺序。这允许格式选择比简单地使用(示例)更容易
-S
--format)
与 animelover1984/youtube-dl 合并:你可以从 animelover1984/youtube-dl 获得大部分功能和改进,包括 、 、 、 在 mp4/ogg/opus 中嵌入缩略图、播放列表 infojson 等。请注意,NicoNico 直播不可用。有关详细信息,请参见 #31。
--write-comments
BiliBiliSearch
BilibiliChannel
YouTube 改进:
ytstories:<channel UCID>
ytsearch:
ytsearchdate:
:ytfav
:ytwatchlater
:ytsubs
:ythistory
:ytrec
:ytnotif)
--live-from-start)
来自浏览器的 Cookie:可以使用以下方法从所有主要的 Web 浏览器中自动提取 Cookie
--cookies-from-browser BROWSER[+KEYRING][:PROFILE][::CONTAINER]
下载时间范围:可以使用以下方法根据时间戳或章节下载视频
--download-sections
按章节拆分视频:可以使用以下方法将视频按章节拆分为多个文件
--split-chapters
多线程片段下载:并行下载多个 m3u8/mpd 视频片段。使用 () 选项设置使用的线程数
--concurrent-fragments
-N
带有 HLS/DASH 的 Aria2c:你可以用作 DASH(mpd) 和 HLS(m3u8) 格式的外部下载器
aria2c
新的MSO:Philo,Spectrum,SlingTV,Cablevision,RCN等。
从清单中提取字幕:可以从流媒体清单中提取字幕。有关详细信息,请参见 commit/be6202f
多个路径和输出模板:你可以为不同类型的文件提供不同的输出模板和下载路径。你还可以使用
--paths(
-P)
可移植配置:配置文件自动从主目录和根目录加载。有关详细信息,请参见 CONFIGURATION
输出模板改进:输出模板现在可以具有日期时间格式、数字偏移量、对象遍历等。有关详细信息,请参阅输出模板。甚至更高级的操作也可以在和 的帮助下完成
--parse-metadata
--replace-in-metadata
其他新选项:添加了许多新选项,例如、、、、等
--alias
--concat-playlist
--wait-for-video
--retry-sleep
--sleep-requests
--convert-thumbnails
--force-download-archive
--force-overwrites
--break-match-filter
改进:正则表达式和其他运算符中的 /、多个和、更快的存档检查、更多格式选择选项、合并多个视频/音频、多个、不同阶段等
--format
--match-filter
--postprocessor-args
--downloader-args
--config-locations
--exec
插件:提取器和后处理器可以从外部文件加载。有关详细信息,请参阅插件
自我更新程序:可以使用 更新版本,如果需要,可以使用 降级
yt-dlp -U
--update-to
自动构建:Nightly/master 构建可以与 和 一起使用
--update-to nightly
--update-to master
标有 * 的功能已向后移植到 youtube-dl
yt-dlp 的一些默认选项与 youtube-dl 和 youtube-dlc 不同:
--auto-number
-A
--title
-t
--literal
-l
avconv不支持作为
ffmpeg
%(title)s [%(id)s].%(ext)s
%(title)s-%(id)s.%(ext)s
--compat-options filename
--format-sort
--compat-options format-sort
bv*+ba/b
-f bv+ba/b
--compat-options format-spec
-f bv*+ba
--audio-multistreams
--video-multistreams
--compat-options multistreams
--no-abort-on-error默认情况下处于启用状态。改用 or 中止错误
--abort-on-error
--compat-options abort-on-error
--no-write-playlist-metafiles
--compat-options no-playlist-metafiles
--add-metadata当与 一起使用时,除了写入元数据外,还会附加 To 文件。使用 或 还原此
infojson
mkv
--write-info-json
--no-embed-info-json
--compat-options no-attach-info-json
parse-metadata
根据自己的喜好修改它,或者用它来恢复它--add-metadata
comment
webpage_url
synopsis
description
--compat-options embed-metadata
playlist_index与 和 等选项一起使用时,其行为会有所不同。有关详细信息,请参见 #302。如果要保留先前的行为,则可以使用
--playlist-reverse
--playlist-items
--compat-options playlist-index
-F
--compat-options list-formats
--sub-langs all,-live_chat
--compat-options no-live-chat
/live
--compat-options no-youtube-channel-redirect
--compat-options no-youtube-unavailable-videos
--compat-options no-youtube-prefer-utc-upload-date
ffmpeg
--compat-options no-direct-merge
mp4
--compat-options embed-thumbnail-atomicparsley
--no-clean-infojson
--compat-options no-clean-infojson
--embed-subs
--write-subs
--embed-subs
--compat-options no-keep-subs
certifi将用于 SSL 根证书(如果已安装)。如果要使用系统证书(例如自签名),请使用
--compat-options no-certifi
--compat-options filename-sanitization
--compat-options no-external-downloader-progress
--match-filter
--compat-options playlist-match-filter
filesize_approx
--compat-options manifest-filesize-approx
requests
--compat-options prefer-legacy-http-handler
urllib
swfinterp
为了便于使用,提供了更多兼容选项:
--compat-options all:使用所有兼容选项(请勿使用)
--compat-options youtube-dl:同
--compat-options all,-multistreams,-playlist-match-filter,-manifest-filesize-approx
--compat-options youtube-dlc:同
--compat-options all,-no-live-chat,-no-youtube-channel-redirect,-playlist-match-filter,-manifest-filesize-approx
--compat-options 2021:同
--compat-options 2022,no-certifi,filename-sanitization,no-youtube-prefer-utc-upload-date
--compat-options 2022:与 相同。使用它来启用所有将来的兼容性选项
--compat-options playlist-match-filter,no-external-downloader-progress,prefer-legacy-http-handler,manifest-filesize-approx
你可以使用二进制文件、pip 或使用第三方包管理器安装 yt-dlp。有关详细说明,请参阅 wiki
如果使用发布二进制文件,则可以用于更新
yt-dlp -U
如果使用 pip 进行安装,只需重新运行用于安装程序的相同命令即可
对于其他第三方包管理器,请参阅 wiki 或参考其文档
二进制文件目前有三个发布渠道:、 和 。
stable
nightly
master
stable是默认通道,其许多更改已经过 AND 通道的用户测试。
nightly
master
nightly
nightly
yt-dlp
--pre
master
使用 / 时,发布二进制文件将仅更新到其当前通道。 可用于在有较新版本可用时切换到其他频道。 还可用于从频道升级或降级到特定标签。
--update
-U
--update-to CHANNEL
--update-to [CHANNEL@]TAG
你还可以使用 () 更新到完全不同存储库上的频道。但是,请注意要更新到的存储库,不会对来自不同存储库的二进制文件进行验证。
--update-to <repository>
<owner>/<repository>
用法示例:
yt-dlp --update-to master切换到频道并更新到其最新版本
master
yt-dlp --update-to stable@2023.07.06升级/降级到版本到频道标签
stable
2023.07.06
yt-dlp --update-to 2023.10.07升级/降级到标记(如果当前通道上存在标记)
2023.10.07
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
文件 | 描述 |
---|---|
YT-DLP型 | 与平台无关的 zipimport 二进制文件。需要 Python(推荐用于 Linux/BSD) |
yt-dlp.exe | Windows (Win7 SP1+) 独立 x64 二进制文件(建议用于 Windows) |
YT-dlp_macos | 通用 MacOS (10.15+) 独立可执行文件(推荐用于 MacOS) |
文件 | 描述 |
---|---|
YT-dlp_x86.exe | Windows (Vista SP2+) 独立 x86(32 位)二进制文件 |
YT-dlp_min.exe | Windows (Win7 SP1+) 独立 x64 二进制文件构建( 不推荐 py2exe) |
YT-dlp_linux | Linux 独立 x64 二进制文件 |
YT-dlp_linux.zip | 未打包的 Linux 可执行文件(无自动更新) |
YT-dlp_linux_armv7l | Linux 独立 armv7l(32 位)二进制文件 |
YT-dlp_linux_aarch64 | Linux 独立 aarch64(64 位)二进制文件 |
YT-dlp_win.zip | 未打包的 Windows 可执行文件(无自动更新) |
YT-dlp_macos.zip | 未打包的 MacOS (10.15+) 可执行文件(无自动更新) |
YT-dlp_macos_legacy | MacOS (10.9+) 独立 x64 可执行文件 |
文件 | 描述 |
---|---|
yt-dlp.tar.gz | 源码压缩包 |
SHA2-512SUMS | GNU 样式的 SHA512 总和 |
SHA2-512SUMS.sig | SHA512 总和的 GPG 签名文件 |
SHA2-256总和 | GNU 样式的 SHA256 总和 |
SHA2-256SUMS.sig | SHA256 总和的 GPG 签名文件 |
可用于验证 GPG 签名的公钥可在此处获得 示例用法:
curl -L https://github.com/yt-dlp/yt-dlp/raw/master/public.key | gpg --import gpg --verify SHA2-256SUMS.sig SHA2-256SUMS gpg --verify SHA2-512SUMS.sig SHA2-512SUMS
注意:手册页、shell 完成(自动完成)文件等在源码压缩包中可用
支持 Python 版本 3.8+(CPython 和 PyPy)。其他版本和实现可能会也可能不会正常工作。
而所有其他依赖项都是可选的,强烈建议使用
ffmpeg
ffprobe
ffmpeg 和 ffprobe - 合并单独的视频和音频文件以及各种后处理任务时需要。许可证取决于内部版本
ffmpeg 中存在一些错误,当与 yt-dlp 一起使用时会导致各种问题。由于 ffmpeg 是一个如此重要的依赖项,我们在 yt-dlp/FFmpeg-Builds 中为其中一些问题提供了带有补丁的自定义构建。有关这些版本解决的具体问题的详细信息,请参阅自述文件
重要提示:你需要的是 ffmpeg 二进制文件,而不是同名的 python 包
--embed-thumbnail
--embed-thumbnail
mp4
m4a
mutagen
ffmpeg
--xattr
--cookies-from-browser
--downloader
rtmp
--downloader ffmpeg
rstp
mms
--downloader ffmpeg
若要使用或重新分发依赖项,必须同意其各自的许可条款。
独立发布二进制文件是使用 Python 解释器构建的,并且包含标有 * 的包。
如果你没有你正在尝试的任务的必要依赖项,yt-dlp 会警告你。所有当前可用的依赖项都显示在输出的顶部
--verbose
要构建独立的可执行文件,你必须具有 Python 和(如果需要,以及 yt-dlp 的任何可选依赖项)。安装完所有必要的依赖项后,只需运行 .可执行文件将针对与 Python 相同的架构(x86/ARM,32/64 位)构建。
pyinstaller
pyinst.py
python3 -m pip install -U pyinstaller -r requirements.txt python3 devscripts/make_lazy_extractors.py python3 pyinst.py
在某些系统上,你可能需要使用 or 代替 。
py
python
python3
pyinst.py接受任何可以传递给 的参数,例如 或 ,此处将对此进行进一步记录。
pyinstaller
--onefile/-F
--onedir/-D
注意:低于 4.4 的 Pyinstaller 版本不支持在不使用虚拟环境的情况下从 Windows 应用商店安装的 Python。
重要提示:官方不支持在不使用的情况下直接运行。这可能正常工作,也可能不正常工作。
pyinstaller
pyinst.py
你将需要构建工具 (3.8+)、、(GNU)、* 和 *。
python
zip
make
pandoc
pytest
安装这些后,只需运行 .
make
你也可以改为运行以仅编译二进制文件,而不更新任何其他文件。(标有 * 的构建工具不需要)
make yt-dlp
虽然我们提供了使用 py2exe 构建的选项,但建议改用 PyInstaller 构建,因为 py2exe 构建不能包含 pycryptodomex/
。certifi,并且需要在目标计算机上运行 VC++14
如果你仍然希望构建它,请安装 Python 和 py2exe,然后只需运行
setup.py py2exe
py -m pip install -U py2exe -r requirements.txt py devscripts/make_lazy_extractors.py py setup.py py2exe
devscripts/update-version.py
- 根据当前日期更新版本号。devscripts/set-variant.py
- 设置可执行文件的构建变体。devscripts/make_changelog.py
- 使用简短的提交消息和更新文件创建 Markdown 更改日志。CONTRIBUTORS
devscripts/make_lazy_extractors.py
- 创建惰性提取器.在构建二进制文件(任何变体)之前运行它将提高其启动性能。如果你希望强制禁用延迟提取器加载,请设置环境变量。YTDLP_NO_LAZY_EXTRACTORS=1
注意:有关详细信息,请参阅它们。
--help
如果在 GitHub 上分叉项目,则可以运行分叉的生成工作流,以自动将所选版本生成为项目。或者,你可以运行发布工作流或启用夜间工作流以创建完整(预)发布。
yt-dlp [OPTIONS] [--] URL [URL...]
Ctrl+F是你的朋友:D
-h, --help Print this help text and exit --version Print program version and exit -U, --update Update this program to the latest version --no-update Do not check for updates (default) --update-to [CHANNEL]@[TAG] Upgrade/downgrade to a specific version. CHANNEL can be a repository as well. CHANNEL and TAG default to "stable" and "latest" respectively if omitted; See "UPDATE" for details. Supported channels: stable, nightly, master -i, --ignore-errors Ignore download and postprocessing errors. The download will be considered successful even if the postprocessing fails --no-abort-on-error Continue with next video on download errors; e.g. to skip unavailable videos in a playlist (default) --abort-on-error Abort downloading of further videos if an error occurs (Alias: --no-ignore-errors) --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 --use-extractors NAMES Extractor names to use separated by commas. You can also use regexes, "all", "default" and "end" (end URL matching); e.g. --ies "holodex.*,end,youtube". Prefix the name with a "-" to exclude it, e.g. --ies default,-generic. Use --list-extractors for a list of extractor names. (Alias: --ies) --default-search PREFIX Use this prefix for unqualified URLs. E.g. "gvsearch2:python" downloads two videos from google videos for the search term "python". 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 Don't load any more configuration files except those given by --config-locations. For backward compatibility, if this option is found inside the system configuration file, the user configuration is not loaded. (Alias: --no-config) --no-config-locations Do not load any custom configuration files (default). When given inside a configuration file, ignore all previous --config-locations defined in the current file --config-locations PATH Location of the main configuration file; either the path to the config or its containing directory ("-" for stdin). Can be used multiple times and inside other configuration files --flat-playlist Do not extract the videos of a playlist, only list them --no-flat-playlist Fully extract the videos of a playlist (default) --live-from-start Download livestreams from the start. Currently only supported for YouTube (Experimental) --no-live-from-start Download livestreams from the current time (default) --wait-for-video MIN[-MAX] Wait for scheduled streams to become available. Pass the minimum number of seconds (or range) to wait between retries --no-wait-for-video Do not wait for scheduled streams (default) --mark-watched Mark videos watched (even with --simulate) --no-mark-watched Do not mark videos watched (default) --color [STREAM:]POLICY Whether to emit color codes in output, optionally prefixed by the STREAM (stdout or stderr) to apply the setting to. Can be one of "always", "auto" (default), "never", or "no_color" (use non color terminal sequences). Can be used multiple times --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 --alias ALIASES OPTIONS Create aliases for an option string. Unless an alias starts with a dash "-", it is prefixed with "--". Arguments are parsed according to the Python string formatting mini-language. E.g. --alias get-audio,-X "-S=aext:{0},abr -x --audio-format {0}" creates options "--get-audio" and "-X" that takes an argument (ARG0) and expands to "-S=aext:ARG0,abr -x --audio-format ARG0". All defined aliases are listed in the --help output. Alias options can trigger more aliases; so be careful to avoid defining recursive options. As a safety measure, each alias may be triggered a maximum of 100 times. This option can be used multiple times
--proxy URL Use the specified HTTP/HTTPS/SOCKS proxy. To enable SOCKS proxy, specify a proper scheme, e.g. socks5://user:pass@127.0.0.1:1080/. Pass in an empty string (--proxy "") for direct connection --socket-timeout SECONDS Time to wait before giving up, in seconds --source-address IP Client-side IP address to bind to -4, --force-ipv4 Make all connections via IPv4 -6, --force-ipv6 Make all connections via IPv6 --enable-file-urls Enable file:// URLs. This is disabled by default for security reasons.
--geo-verification-proxy URL Use this proxy to verify the IP address for some geo-restricted sites. The default proxy specified by --proxy (or none, if the option is not present) is used for the actual downloading --xff VALUE How to fake X-Forwarded-For HTTP header to try bypassing geographic restriction. One of "default" (only when known to be useful), "never", an IP block in CIDR notation, or a two-letter ISO 3166-2 country code
-I, --playlist-items ITEM_SPEC Comma separated playlist_index of the items to download. You can specify a range using "[START]:[STOP][:STEP]". For backward compatibility, START-STOP is also supported. Use negative indices to count from the right and negative STEP to download in reverse order. E.g. "-I 1:3,7,-5::2" used on a playlist of size 15 will download the items at index 1,2,3,7,11,13,15 --min-filesize SIZE Abort download if filesize is smaller than SIZE, e.g. 50k or 44.6M --max-filesize SIZE Abort download if filesize is larger than SIZE, e.g. 50k or 44.6M --date DATE Download only videos uploaded on this date. The date can be "YYYYMMDD" or in the format [now|today|yesterday][-N[day|week|month|year]]. E.g. "--date today-2weeks" downloads only videos uploaded on the same day two weeks ago --datebefore DATE Download only videos uploaded on or before this date. The date formats accepted is the same as --date --dateafter DATE Download only videos uploaded on or after this date. The date formats accepted is the same as --date --match-filters FILTER Generic video filter. Any "OUTPUT TEMPLATE" field 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, use "!field" to check if the field is not present, and "&" to check multiple conditions. Use a "\" to escape "&" or quotes if needed. If used multiple times, the filter matches if atleast one of the conditions are met. E.g. --match-filter !is_live --match-filter "like_count>?100 & description~='(?i)\bcats \& dogs\b'" matches only videos that are not live OR those that have a like count more than 100 (or the like field is not available) and also has a description that contains the phrase "cats & dogs" (caseless). Use "--match-filter -" to interactively ask whether to download each video --no-match-filters Do not use any --match-filter (default) --break-match-filters FILTER Same as "--match-filters" but stops the download process when a video is rejected --no-break-match-filters Do not use any --break-match-filters (default) --no-playlist Download only the video, if the URL refers to a video and a playlist --yes-playlist Download the playlist, if the URL refers to a video and a playlist --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 --no-download-archive Do not use archive file (default) --max-downloads NUMBER Abort after downloading NUMBER files --break-on-existing Stop the download process when encountering a file that is in the archive --break-per-input Alters --max-downloads, --break-on-existing, --break-match-filter, and autonumber to reset per input URL --no-break-per-input --break-on-existing and similar options terminates the entire download queue --skip-playlist-after-errors N Number of allowed failures until the rest of the playlist is skipped
-N, --concurrent-fragments N Number of fragments of a dash/hlsnative video that should be downloaded concurrently (default is 1) -r, --limit-rate RATE Maximum download rate in bytes per second, e.g. 50K or 4.2M --throttled-rate RATE Minimum download rate in bytes per second below which throttling is assumed and the video data is re-extracted, e.g. 100K -R, --retries RETRIES Number of retries (default is 10), or "infinite" --file-access-retries RETRIES Number of times to retry on file access error (default is 3), or "infinite" --fragment-retries RETRIES Number of retries for a fragment (default is 10), or "infinite" (DASH, hlsnative and ISM) --retry-sleep [TYPE:]EXPR Time to sleep between retries in seconds (optionally) prefixed by the type of retry (http (default), fragment, file_access, extractor) to apply the sleep to. EXPR can be a number, linear=START[:END[:STEP=1]] or exp=START[:END[:BASE=2]]. This option can be used multiple times to set the sleep for the different retry types, e.g. --retry-sleep linear=1::2 --retry-sleep fragment:exp=1:20 --skip-unavailable-fragments Skip unavailable fragments for DASH, hlsnative and ISM downloads (default) (Alias: --no-abort-on-unavailable-fragments) --abort-on-unavailable-fragments Abort download if a fragment is unavailable (Alias: --no-skip-unavailable-fragments) --keep-fragments Keep downloaded fragments on disk after downloading is finished --no-keep-fragments Delete downloaded fragments after downloading is finished (default) --buffer-size SIZE Size of download buffer, e.g. 1024 or 16K (default is 1024) --resize-buffer The buffer size is automatically resized from an initial value of --buffer-size (default) --no-resize-buffer Do not automatically adjust the buffer size --http-chunk-size SIZE Size of a chunk for chunk-based HTTP downloading, e.g. 10485760 or 10M (default is disabled). May be useful for bypassing bandwidth throttling imposed by a webserver (experimental) --playlist-random Download playlist videos in random order --lazy-playlist Process entries in the playlist as they are received. This disables n_entries, --playlist-random and --playlist-reverse --no-lazy-playlist Process videos in the playlist only after the entire playlist is parsed (default) --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 --download-sections REGEX Download only chapters that match the regular expression. A "*" prefix denotes time-range instead of chapter. Negative timestamps are calculated from the end. "*from-url" can be used to download between the "start_time" and "end_time" extracted from the URL. Needs ffmpeg. This option can be used multiple times to download multiple sections, e.g. --download-sections "*10:15-inf" --download-sections "intro" --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. You can use this option multiple times to set different downloaders for different protocols. E.g. --downloader aria2c --downloader "dash,m3u8:native" will use aria2c for http/ftp downloads, and the native downloader for dash/m3u8 downloads (Alias: --external-downloader) --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 (Alias: --external-downloader-args)
-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 --no-batch-file Do not read URLs from batch file (default) -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 --output 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 --output-na-placeholder TEXT Placeholder for unavailable fields in "OUTPUT TEMPLATE" (default: "NA") --restrict-filenames Restrict filenames to only ASCII characters, and avoid "&" and spaces in filenames --no-restrict-filenames Allow Unicode characters, "&" and spaces in filenames (default) --windows-filenames Force filenames to be Windows-compatible --no-windows-filenames Make filenames Windows-compatible only if using Windows (default) --trim-filenames LENGTH Limit the filename length (excluding extension) to the specified number of characters -w, --no-overwrites Do not overwrite any files --force-overwrites Overwrite all video and metadata files. This option includes --no-continue --no-force-overwrites Do not overwrite the video, but overwrite related files (default) -c, --continue Resume partially downloaded files/fragments (default) --no-continue Do not resume partially downloaded fragments. If the file is not fragmented, restart download of the entire file --part Use .part files instead of writing directly into output file (default) --no-part Do not use .part files - write directly into output file --mtime Use the Last-modified header to set the file modification time (default) --no-mtime Do not use the Last-modified header to set the file modification time --write-description Write video description to a .description file --no-write-description Do not write video description (default) --write-info-json Write video metadata to a .info.json file (this may contain personal information) --no-write-info-json Do not write video metadata (default) --write-playlist-metafiles Write playlist metadata in addition to the video metadata when using --write-info-json, --write-description etc. (default) --no-write-playlist-metafiles Do not write playlist metadata when using --write-info-json, --write-description etc. --clean-info-json Remove some internal metadata such as filenames from the infojson (default) --no-clean-info-json 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 (Alias: --get-comments) --no-write-comments Do not retrieve video comments unless the extraction is known to be quick (Alias: --no-get-comments) --load-info-json FILE JSON file containing the video information (created with the "--write-info-json" option) --cookies FILE Netscape formatted file to read cookies from and dump cookie jar in --no-cookies Do not read/dump cookies from/to file (default) --cookies-from-browser BROWSER[+KEYRING][:PROFILE][::CONTAINER] The name of the browser to load cookies from. Currently supported browsers are: brave, chrome, chromium, edge, firefox, opera, safari, vivaldi. Optionally, the KEYRING used for decrypting Chromium cookies on Linux, the name/path of the PROFILE to load cookies from, and the CONTAINER name (if Firefox) ("none" for no container) can be given with their respective seperators. By default, all containers of the most recently accessed profile are used. Currently supported keyrings are: basictext, gnomekeyring, kwallet, kwallet5, kwallet6 --no-cookies-from-browser Do not load cookies from browser (default) --cache-dir DIR Location in the filesystem where yt-dlp can store some downloaded information (such as client ids and signatures) permanently. By default ${XDG_CACHE_HOME}/yt-dlp --no-cache-dir Disable filesystem caching --rm-cache-dir Delete all filesystem cache files
--write-thumbnail Write thumbnail image to disk --no-write-thumbnail Do not write thumbnail image to disk (default) --write-all-thumbnails Write all thumbnail image formats to disk --list-thumbnails List available thumbnails of each video. Simulate unless --no-simulate is used
--write-link Write an internet shortcut file, depending on the current platform (.url, .webloc or .desktop). The URL may be cached by the OS --write-url-link Write a .url Windows internet shortcut. The OS caches the URL based on the file path --write-webloc-link Write a .webloc macOS internet shortcut --write-desktop-link Write a .desktop Linux internet shortcut
-q, --quiet Activate quiet mode. If used with --verbose, print the log to stderr --no-quiet Deactivate quiet mode. (Default) --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. Useful 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 (Alias: --no-download) -O, --print [WHEN:]TEMPLATE Field name or output template to print to screen, optionally prefixed with when to print it, separated by a ":". Supported values of "WHEN" are the same as that of --use-postprocessor (default: video). Implies --quiet. Implies --simulate unless --no-simulate or later stages of WHEN are used. This option can be used multiple times --print-to-file [WHEN:]TEMPLATE FILE Append given template to the file. The values of WHEN and TEMPLATE are same as that of --print. FILE uses the same syntax as the output template. This option can be used multiple times -j, --dump-json Quiet, but print JSON information for each video. Simulate unless --no-simulate is used. See "OUTPUT TEMPLATE" for a description of available keys -J, --dump-single-json Quiet, but print JSON information for each url or infojson passed. Simulate unless --no-simulate is used. 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 (Alias: --force-download-archive) --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. E.g. --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
--encoding ENCODING Force the specified encoding (experimental) --legacy-server-connect Explicitly allow HTTPS connection to servers that do not support RFC 5746 secure renegotiation --no-check-certificates Suppress HTTPS certificate validation --prefer-insecure Use an unencrypted connection to retrieve information about the video (Currently supported only for YouTube) --add-headers FIELD:VALUE Specify a custom HTTP header and its value, separated by a colon ":". You can use this option multiple times --bidi-workaround Work around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATH --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
-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 --format-sort-force Force user specified sort order to have precedence over all fields, see "Sorting Formats" for more details (Alias: --S-force) --no-format-sort-force Some fields have precedence over the user specified sort order (default) --video-multistreams Allow multiple video streams to be merged into a single file --no-video-multistreams Only one video stream is downloaded for each output file (default) --audio-multistreams Allow multiple audio streams to be merged into a single file --no-audio-multistreams Only one audio stream is downloaded for each output file (default) --prefer-free-formats Prefer video formats with free containers over non-free ones of same quality. Use with "-S ext" to strictly prefer free containers irrespective of quality --no-prefer-free-formats Don't give any special preference to free containers (default) --check-formats Make sure formats are selected only from those that are actually downloadable --check-all-formats Check all formats for whether they are actually downloadable --no-check-formats Do not check that the formats are actually downloadable -F, --list-formats List available formats of each video. Simulate unless --no-simulate is used --merge-output-format FORMAT Containers that may be used when merging formats, separated by "/", e.g. "mp4/mkv". Ignored if no merge is required. (currently supported: avi, flv, mkv, mov, mp4, webm)
--write-subs Write subtitle file --no-write-subs Do not write subtitle file (default) --write-auto-subs Write automatically generated subtitle file (Alias: --write-automatic-subs) --no-write-auto-subs Do not write auto-generated subtitles (default) (Alias: --no-write-automatic-subs) --list-subs List available subtitles of each video. Simulate unless --no-simulate is used --sub-format FORMAT Subtitle format; accepts formats preference, e.g. "srt" or "ass/srt/best" --sub-langs LANGS Languages of the subtitles to download (can be regex) or "all" separated by commas, e.g. --sub-langs "en.*,ja". You can prefix the language code with a "-" to exclude it from the requested languages, e.g. --sub-langs all,-live_chat. Use --list-subs for a list of available language tags
-u, --username USERNAME Login with this account ID -p, --password PASSWORD Account password. If this option is left out, yt-dlp will ask interactively -2, --twofactor TWOFACTOR Two-factor authentication code -n, --netrc Use .netrc authentication data --netrc-location PATH Location of .netrc authentication data; either the path or its containing directory. Defaults to ~/.netrc --netrc-cmd NETRC_CMD Command to execute to get the credentials for an extractor. --video-password PASSWORD Video-specific password --ap-mso MSO Adobe Pass multiple-system operator (TV provider) identifier, use --ap-list-mso for a list of available MSOs --ap-username USERNAME Multiple-system operator account login --ap-password PASSWORD Multiple-system operator account password. If this option is left out, yt-dlp will ask interactively --ap-list-mso List all supported multiple-system operators --client-certificate CERTFILE Path to client certificate file in PEM format. May include the private key --client-certificate-key KEYFILE Path to private key file for client certificate --client-certificate-password PASSWORD Password for client certificate private key, if encrypted. If not provided, and the key is encrypted, yt-dlp will ask interactively
-x, --extract-audio Convert video files to audio-only files (requires ffmpeg and ffprobe) --audio-format FORMAT Format to convert the audio to when -x is used. (currently supported: best (default), aac, alac, flac, m4a, mp3, opus, vorbis, wav). You can specify multiple rules using similar syntax as --remux-video --audio-quality QUALITY Specify ffmpeg audio quality to use when converting the audio with -x. Insert a value between 0 (best) and 10 (worst) for VBR or a specific bitrate like 128K (default 5) --remux-video FORMAT Remux the video into another container if necessary (currently supported: avi, flv, gif, mkv, mov, mp4, webm, aac, aiff, alac, flac, m4a, mka, mp3, ogg, opus, vorbis, wav). If target container does not support the video/audio codec, remuxing will fail. You can specify multiple rules; e.g. "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 necessary. The syntax and supported formats are the same as --remux-video --postprocessor-args NAME:ARGS Give these arguments to the postprocessors. Specify the postprocessor/executable 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, e.g. --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-keep-video Delete the intermediate video file after post-processing (default) --post-overwrites Overwrite post-processed files (default) --no-post-overwrites Do not overwrite post-processed files --embed-subs Embed subtitles in the video (only for mp4, webm and mkv videos) --no-embed-subs Do not embed subtitles (default) --embed-thumbnail Embed thumbnail in the video as cover art --no-embed-thumbnail Do not embed thumbnail (default) --embed-metadata Embed metadata to the video file. Also embeds chapters/infojson if present unless --no-embed-chapters/--no-embed-info-json are used (Alias: --add-metadata) --no-embed-metadata Do not add metadata to file (default) (Alias: --no-add-metadata) --embed-chapters Add chapter markers to the video file (Alias: --add-chapters) --no-embed-chapters Do not add chapter markers (default) (Alias: --no-add-chapters) --embed-info-json Embed the infojson as an attachment to mkv/mka video files --no-embed-info-json Do not embed the infojson as an attachment to the video file --parse-metadata [WHEN:]FROM:TO Parse additional metadata like title/artist from other fields; see "MODIFYING METADATA" for details. Supported values of "WHEN" are the same as that of --use-postprocessor (default: pre_process) --replace-in-metadata [WHEN:]FIELDS REGEX REPLACE Replace text in a metadata field using the given regex. This option can be used multiple times. Supported values of "WHEN" are the same as that of --use-postprocessor (default: pre_process) --xattrs Write metadata to the video file's xattrs (using dublin core and xdg standards) --concat-playlist POLICY Concatenate videos in a playlist. One of "never", "always", or "multi_video" (default; only when the videos form a single show). All the video files must have same codecs and number of streams to be concatable. The "pl_video:" prefix can be used with "--paths" and "--output" to set the output filename for the concatenated files. See "OUTPUT TEMPLATE" for details --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 [WHEN:]CMD Execute a command, optionally prefixed with when to execute it, separated by a ":". Supported values of "WHEN" are the same as that of --use-postprocessor (default: after_move). Same syntax as the output template can be used to pass any field as arguments to the command. If no fields are passed, %(filepath,_filename|)q is appended to the end of the command. This option can be used multiple times --no-exec Remove any previously defined --exec --convert-subs FORMAT Convert the subtitles to another format (currently supported: ass, lrc, srt, vtt) (Alias: --convert-subtitles) --convert-thumbnails FORMAT Convert the thumbnails to another format (currently supported: jpg, png, webp). You can specify multiple rules using similar syntax as --remux-video --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 --no-split-chapters Do not split video based on chapters (default) --remove-chapters REGEX Remove chapters whose title matches the given regular expression. The syntax is the same as --download-sections. This option can be used multiple times --no-remove-chapters Do not remove any chapters from the file (default) --force-keyframes-at-cuts Force keyframes at cuts when downloading/splitting/removing sections. This is slow due to needing a re-encode, 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, separated 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 video extraction), "after_filter" (after video passes filter), "video" (after --format; before --print/--output), "before_dl" (before each video download), "post_process" (after each video download; default), "after_move" (after moving video file to it's final locations), "after_video" (after downloading and processing all formats of a video), or "playlist" (at end of playlist). This option can be used multiple times to add different postprocessors
为各个部分(发起人、 介绍等)使用 SponsorBlock API 从下载的 YouTube 视频中
--sponsorblock-mark CATS SponsorBlock categories to create chapters for, separated by commas. Available categories are sponsor, intro, outro, selfpromo, preview, filler, interaction, music_offtopic, poi_highlight, chapter, all and default (=all). You can prefix the category with a "-" to exclude it. See [1] for description of the categories. E.g. --sponsorblock-mark all,-preview [1] https://wiki.sponsor.ajay.app/w/Segment_Categories --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 except that "default" refers to "all,-filler" and poi_highlight, chapter are not available --sponsorblock-chapter-title TEMPLATE An output template for the title of the SponsorBlock chapters created by --sponsorblock-mark. 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-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 IE_KEY:ARGS Pass ARGS arguments to the IE_KEY extractor. See "EXTRACTOR ARGUMENTS" for details. You can use this option multiple times to give arguments for different extractors
你可以通过将任何受支持的命令行选项放入配置文件来配置 yt-dlp。配置从以下位置加载:
主要配置:
--config-location
便携式配置:(推荐用于便携式安装)
yt-dlp.conf
yt-dlp.conf
yt_dlp
家庭配置:
yt-dlp.conf在给出的主路径中
-P
-P
用户配置:
${XDG_CONFIG_HOME}/yt-dlp.conf
${XDG_CONFIG_HOME}/yt-dlp/config(推荐在 Linux/macOS 上使用)
${XDG_CONFIG_HOME}/yt-dlp/config.txt
${APPDATA}/yt-dlp.conf
${APPDATA}/yt-dlp/config(推荐在 Windows 上)
${APPDATA}/yt-dlp/config.txt
~/yt-dlp.conf
~/yt-dlp.conf.txt
~/.yt-dlp/config
~/.yt-dlp/config.txt
Смотритетакже: 关于环境变量的注意事项
系统配置:
/etc/yt-dlp.conf
/etc/yt-dlp/config
/etc/yt-dlp/config.txt
例如,使用以下配置文件,yt-dlp 将始终提取音频,而不是复制 mtime,使用代理并将所有视频保存在主目录的目录下:
YouTube
# Lines starting with # are comments # Always extract audio -x # Do not copy the mtime --no-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
注意:配置文件中的选项与常规命令行调用中使用的选项(又名开关)相同;因此,在 或 之后不能有空格,例如 或但不是 或 .必要时也必须引用它们,就好像它是 UNIX shell 一样。
-
--
-o
--proxy
- o
-- proxy
如果要禁用特定 yt-dlp 运行的所有配置文件,则可以使用。如果在任何配置文件中找到,则不会加载进一步的配置。例如,在可移植配置文件中包含该选项会阻止加载主配置、用户配置和系统配置。此外,(为了向后兼容)如果在系统配置文件中找到,则不会加载用户配置。
--ignore-config
--ignore-config
--ignore-config
配置文件根据 UTF BOM 进行解码(如果存在),否则根据系统语言环境的编码进行解码。
如果你希望以不同的方式解码文件,请添加到文件的开头(例如)。在此之前不得有字符,甚至不能有空格或 BOM。
# coding: ENCODING
# coding: shift-jis
你可能还希望为支持身份验证的提取器配置自动凭据存储(通过提供带有 和 的登录名和密码),以便不会在每次 yt-dlp 执行时将凭据作为命令行参数传递,并防止在 shell 命令历史记录中跟踪纯文本密码。你可以在每个提取程序的基础上使用 .netrc 文件
来实现此目的。为此,你需要创建一个文件,并限制只有你才能读/写:
--username
--password
.netrc
--netrc-location
touch ${HOME}/.netrc chmod a-rwx,u+rw ${HOME}/.netrc
之后,你可以按以下格式添加提取程序的凭据,其中提取器是提取程序的名称(小写):
machine <extractor> login <username> password <password>
例如
machine youtube login myaccount@gmail.com password my_youtube_password machine twitch login my_twitch_account_name password my_twitch_password
要使用该文件激活身份验证,你应该传递给 yt-dlp 或将其放在配置文件中。
.netrc
--netrc
.netrc 文件的默认位置是(见下文)。
~
作为使用该文件的替代方法,该文件的缺点是将密码保存在纯文本文件中,你可以配置自定义 shell 命令来为提取程序提供凭据。这是通过提供参数来完成的,它应该以 netrc 格式输出凭据并在成功时返回,其他值将被视为错误。 在命令中将替换为提取器的名称,以便为正确的提取器选择凭据。
.netrc
--netrc-cmd
0
{}
例如,使用存储为
.netrc
.authinfo.gpg
yt-dlp --netrc-cmd 'gpg --decrypt ~/.authinfo.gpg' https://www.youtube.com/watch?v=BaW_jenozKc
${VARIABLE}
$VARIABLE
%VARIABLE%
${VARIABLE}
--output
--config-location
${XDG_CONFIG_HOME}
~/.config
${XDG_CACHE_HOME}
~/.cache
~
${HOME}
${USERPROFILE}
${HOMEDRIVE}${HOMEPATH}
${USERPROFILE}
C:\Users\<user name>
${APPDATA}
${USERPROFILE}\AppData\Roaming
该选项用于指示输出文件名的模板,而选项用于指定每种类型的文件应保存到的路径。
-o
-P
tl;DR:引导我查看示例。
最简单的用法是在下载单个文件时不要设置任何模板参数,例如 in(不建议使用这样的硬编码文件扩展名,否则可能会破坏一些后处理)。
-o
yt-dlp -o funny_video.flv "https://some/video"
但是,它还可能包含下载每个视频时将被替换的特殊序列。特殊序列可以根据 Python 字符串格式化操作进行格式化,例如 或。为了澄清,这是一个百分号,后跟括号中的名称,后跟格式化操作。
%(NAME)s
%(NAME)05d
字段名称本身(括号内的部分)也可以具有一些特殊格式:
对象遍历:元数据中可用的字典和列表可以使用点分隔符遍历;例如,.你可以用冒号做Python切片;例如,.大括号可用于构建仅包含特定键的词典;例如。空字段名称是指整个 infodict;例如。请注意,下面未列出使用此方法可用的所有字段。用于查看此类字段
.
%(tags.0)s
%(subtitles.en.-1.ext)s
:
%(id.3:7:-1)s
%(formats.:.format_id)s
{}
%(formats.:.{format_id,height})#j
%()s
%(.{id,title})s
-j
算术:可以使用 和 对数值字段进行简单的算术运算。例如,
+
-
*
%(playlist_index+10)03d
%(n_entries+1-playlist_index)d
日期/时间格式:日期/时间字段可以根据 strftime 格式设置格式,方法是使用 .例如 , ,
>
%(duration>%H-%M-%S)s
%(upload_date>%Y-%m-%d)s
%(epoch-3600>%H-%M-%S)s
备选字段:可以指定备用字段,并用 .例如
,
%(release_date>%Y,upload_date>%Y|Unknown)s
替换:可以根据 str.format 迷你语言
使用分隔符指定替换值。如果字段不为空,则将使用此替换值而不是实际字段内容。这是在考虑备用字段后完成的;因此,如果任何替代字段不为空,则使用替换。例如,
&
%(chapters&has chapters|no chapters)s
%(title&TITLE={:>20}|NO TITLE)s
默认值:当字段为空时,可以使用分隔符指定文本默认值。这将覆盖 .例如
|
--output-na-placeholder
%(uploader|Unknown)s
更多转换:除了普通的格式类型外,yt-dlp 还支持转换为 = Bytes、= json(漂亮打印的标志,用于 Unicode)、= HTML 转义、= 逗号分隔的 l ist(换行符分隔的标志)、= 终端的字符串 quoted(将列表拆分为不同参数的标志)、= 添加 D等后缀(例如 10M)(标志使用 1024 作为因子), 和 = Sanitize 作为文件名(受限制的标志)
diouxXeEfFgGcrs
B
j
#
+
h
l
#
\n
q
#
D
#
S
#
Unicode 规范化:格式类型可用于 NFC Unicode 规范化。备用形式标志 () 将规范化更改为 NFD,转换标志可用于 NFKC/NFKD 兼容性等效规范化。例如 是NFKC
U
#
+
%(title)+.100U
总而言之,字段的一般语法是:
%(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
可用字段包括:
id(string):视频标识符
title(字符串):视频标题
fulltitle(字符串):忽略实时时间戳和通用标题的视频标题
ext(string):视频文件扩展名
alt_title(string):视频的辅助标题
description(string):视频的描述
display_id(string):视频的替代标识符
uploader(string):视频上传者的全名
license(字符串):视频获得许可的许可证名称
creator(string):视频的创建者
timestamp(数字):视频可用时的 UNIX 时间戳
upload_date(string):视频上传日期,UTC (YYYYMMDD)
release_timestamp(数字):视频发布时的 UNIX 时间戳
release_date(string):以 UTC 格式发布视频的日期 (YYYYMMDD)
release_year(数字):视频或专辑发行的年份 (YYYY)
modified_timestamp(数字):上次修改视频时的 UNIX 时间戳
modified_date(string):上次在 UTC 中修改视频的日期 (YYYYMMDD)
uploader_id(string):视频上传者的昵称或 ID
channel(string):上传视频的频道的全名
channel_id(string):通道的 ID
channel_follower_count(数字):频道的关注者数量
channel_is_verified(boolean):频道是否在平台上验证过
location(字符串):视频拍摄的实际位置
duration(数字):视频的长度(以秒为单位)
duration_string(string):视频长度 (HH:mm:ss)
view_count(数字):平台上观看了视频的用户数量
concurrent_view_count(数字):当前有多少用户在平台上观看视频。
like_count(数字):视频的正面评分数
dislike_count(数字):视频的负面评分数
repost_count(数字):视频的转发次数
average_rating(数字):用户给出的平均评分,使用的等级取决于网页
comment_count(数字):视频的评论数(对于某些提取器,评论仅在末尾下载,因此无法使用此字段)
age_limit(数字):视频的年龄限制(岁)
live_status(字符串):“not_live”、“is_live”、“is_upcoming”、“was_live”、“post_live”之一(已上线,但 VOD 尚未处理)
is_live(boolean):此视频是直播视频还是固定长度视频
was_live(boolean):此视频最初是否为直播
playable_in_embed(string):是否允许此视频在其他站点的嵌入式播放器中播放
availability(字符串):视频是“私享”、“premium_only”、“subscriber_only”、“needs_auth”、“不公开列出”还是“公开”
media_type(字符串):按网站分类的媒体类型,例如“剧集”、“剪辑”、“预告片”
start_time(数字):应开始复制的时间(以秒为单位),如 URL 中指定的那样
end_time(数字):复制应结束的时间(以秒为单位),如 URL 中指定的那样
extractor(string):提取器的名称
extractor_key(string):提取器的键名
epoch(数字):信息提取完成时的 Unix 纪元
autonumber(数字):每次下载时都会增加的数字,从 开始,用前导零填充到 5 位数字
--autonumber-start
video_autonumber(数字):每个视频将增加的数目
n_entries(数字):播放列表中提取的项目总数
playlist_id(string):包含视频的播放列表的标识符
playlist_title(string):包含视频的播放列表的名称
playlist(字符串):或
playlist_id
playlist_title
playlist_count(数字):播放列表中的项目总数。如果未提取整个播放列表,则可能不知道
playlist_index(数字):播放列表中视频的索引,根据最终索引用前导零填充
playlist_autonumber(数字):视频在播放列表下载队列中的位置,根据播放列表的总长度用前导零填充
playlist_uploader(string):播放列表上传者的全名
playlist_uploader_id(string):播放列表上传者的昵称或 ID
webpage_url(string):视频网页的 URL,如果将其提供给 yt-dlp,则应允许再次获得相同的结果
webpage_url_basename(string):网页 URL 的基本名称
webpage_url_domain(string):网页 URL 的域
original_url(string):用户提供的 URL(或与播放列表条目的 URL 相同)
webpage_url
也可以使用“过滤格式”中的所有字段
适用于属于某个逻辑章节或部分的视频:
chapter(string):视频所属章节的名称或标题
chapter_number(数字):视频所属章节的编号
chapter_id(string):视频所属章节的 ID
适用于属于某些系列或节目的一集的视频:
series(字符串):视频剧集所属的系列或节目的标题
season(字符串):视频剧集所属季节的标题
season_number(数字):视频剧集所属的季节编号
season_id(string):视频剧集所属季节的 ID
episode(字符串):视频剧集的标题
episode_number(数字):每季视频集数
episode_id(string):视频剧集的 ID
适用于作为音乐专辑中的曲目或一部分的媒体:
track(string):曲目标题
track_number(数字):专辑或光盘中的曲目编号
track_id(string):曲目的 ID
artist(string):曲目的艺术家
genre(string):曲目的流派
album(string):曲目所属专辑的标题
album_type(string):相册的类型
album_artist(字符串):专辑中出现的所有艺术家的列表
disc_number(数字):轨道所属的光盘或其他物理介质的编号
仅在使用时可用,在用于包含内部章节的视频时为 for 前缀时可用:
--download-sections
chapter:
--split-chapters
section_title(string):章节标题
section_number(数字):文件中章节的编号
section_start(数字):章节的开始时间(以秒为单位)
section_end(数字):章节的结束时间(以秒为单位)
仅在以下环境中使用时可用:
urls(string):所有请求格式的 URL,每行一个
filename(string):视频文件的名称。请注意,实际文件名可能有所不同
formats_table(表):打印的视频格式表
--list-formats
thumbnails_table(table):由
--list-thumbnails
subtitles_table(表):打印的字幕格式表
--list-subs
automatic_captions_table(表):打印的自动字幕格式表
--list-subs
仅在下载视频后可用 (/):
post_process
after_move
filepath:下载视频文件的实际路径
仅适用于:
--sponsorblock-chapter-title
start_time(数字):章节的开始时间(以秒为单位)
end_time(数字):章节的结束时间(以秒为单位)
categories(list):该章节所属的 SponsorBlock 类别
category(string):章节所属的最小 SponsorBlock 类别
category_names(列表):类别的友好名称
name(string): 最小类别的友好名称
type(string):章节的 SponsorBlock 操作类型
在输出模板中引用上述每个序列时,将替换为与序列名称对应的实际值。例如,for 和带有标题和 id 的 mp4 视频,这将导致在当前目录中创建一个文件。
-o %(title)s-%(id)s.%(ext)s
yt-dlp test video
BaW_jenozKc
yt-dlp test video-BaW_jenozKc.mp4
注意:某些序列不保证存在,因为它们依赖于特定提取器获得的元数据。此类序列将替换为 ( 默认) 提供的占位符值。
--output-na-placeholder
NA
提示:查看输出以确定哪些字段可用于特定网址
-j
对于数字序列,你可以使用与数字相关的格式;例如 将生成一个字符串,其中视图计数填充了最多 5 个字符的零,如 .
%(view_count)05d
00042
输出模板还可以包含任意分层路径,例如 这将导致将每个视频下载到与此路径模板对应的目录中。任何缺少的目录都将自动为你创建。
-o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s"
若要在输出模板中使用百分比文本,请使用 。要输出到 stdout,请使用 .
%%
-o -
当前的默认模板是 。
%(title)s [%(id)s].%(ext)s
在某些情况下,你不需要特殊字符,例如中、空格或 &,例如将下载的文件名传输到 Windows 系统或通过 8 位不安全通道传输文件名时。在这些情况下,请添加标志以获得较短的标题。
--restrict-filenames
$ yt-dlp --print filename -o "test video.%(ext)s" BaW_jenozKc
test video.webm # Literal name with correct extension
$ yt-dlp --print filename -o "%(title)s.%(ext)s" BaW_jenozKc
youtube-dl test video ''_ä↭𝕐.webm # All kinds of weird characters
$ yt-dlp --print filename -o "%(title)s.%(ext)s" BaW_jenozKc --restrict-filenames
youtube-dl_test_video_.webm # Restricted file name
# Download YouTube playlist videos in separate directory indexed by video order in a playlist
$ yt-dlp -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" "https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re"
# Download YouTube playlist videos in separate directories according to their uploaded year
$ yt-dlp -o "%(upload_date>%Y)s/%(title)s.%(ext)s" "https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re"
# Prefix playlist index with " - " separator, but only if it is available
$ yt-dlp -o "%(playlist_index&{} - |)s%(title)s.%(ext)s" BaW_jenozKc "https://www.youtube.com/user/TheLinuxFoundation/playlists"
# Download all playlists of YouTube channel/user keeping each playlist in separate directory:
$ yt-dlp -o "%(uploader)s/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" "https://www.youtube.com/user/TheLinuxFoundation/playlists"
# Download Udemy course keeping each chapter in separate directory under MyVideos directory in your home
$ 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"
# Download entire series season keeping each series and each season in separate directory under 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"
# Download video as "C:\MyVideos\uploader\title.ext", subtitles as "C:\MyVideos\subs\uploader\title.ext"
# and put all temporary files in "C:\MyVideos\tmp"
$ yt-dlp -P "C:/MyVideos" -P "temp:tmp" -P "subtitle:subs" -o "%(uploader)s/%(title)s.%(ext)s" BaW_jenoz --write-subs
# Download video as "C:\MyVideos\uploader\title.ext" and subtitles as "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" BaW_jenozKc --write-subs
# Stream the video being downloaded to stdout
$ yt-dlp -o - BaW_jenozKc
默认情况下,如果你不传递任何选项,yt-dlp 会尝试下载最佳可用质量。 这通常等同于使用 .但是,如果启用了多个音频流 (),则默认格式将更改为 。同样,如果 ffmpeg 不可用,或者使用 yt-dlp 流式传输到 (),则默认值变为 .
-f bestvideo*+bestaudio/best
--audio-multistreams
-f bestvideo+bestaudio/best
stdout
-o -
-f best/bestvideo+bestaudio
弃用警告:最新版本的 yt-dlp 可以使用 ffmpeg 将多种格式同时流式传输到 stdout。因此,在未来的版本中,默认值将设置为类似于正常下载。如果要保留该设置,建议在配置选项中显式指定该设置。
-f bv*+ba/b
-f b/bv+ba
格式选择的一般语法是 (或 ),其中是选择器表达式,即描述要下载的格式或格式的表达式。
-f FORMAT
--format FORMAT
FORMAT
tl;DR:引导我查看示例。
最简单的情况是请求特定格式;例如,你可以下载格式代码等于 22 的格式。你可以使用 或 获取特定视频的可用格式代码列表。请注意,这些格式代码是特定于提取程序的。
-f 22
--list-formats
-F
你还可以使用文件扩展名(目前支持、、、)来下载特定文件扩展名的最佳质量格式,例如 将下载最优质的格式,扩展名作为单个文件。
3gp
aac
flv
m4a
mp3
mp4
ogg
wav
webm
-f webm
webm
你可以使用以交互方式为每个视频提供格式选择器
-f -
你还可以使用特殊名称来选择特定的边缘情况格式:
all:分别选择所有格式
mergeall:选择并合并所有格式(必须与 一起使用,或两者一起使用)
--audio-multistreams
--video-multistreams
b*、:选择包含视频或音频或两者兼而有之的最佳质量格式(即;
best*
vcodec!=none or acodec!=none)
b、 :选择同时包含视频和音频的最佳质量格式。相当于
best
best*[vcodec!=none][acodec!=none]
bv、 :选择质量最佳的纯视频格式。相当于
bestvideo
best*[acodec=none]
bv*、 :选择包含视频的最佳质量格式。它还可能包含音频。相当于
bestvideo*
best*[vcodec!=none]
ba、:选择质量最好的纯音频格式。相当于
bestaudio
best*[vcodec=none]
ba*、 :选择包含音频的最佳质量格式。它还可能包含视频。相当于(请勿使用!
bestaudio*
best*[acodec!=none])
w*、 :选择包含视频或音频的最差质量格式
worst*
w、 :选择同时包含视频和音频的最差质量格式。相当于
worst
worst*[vcodec!=none][acodec!=none]
wv、 :选择质量最差的纯视频格式。相当于
worstvideo
worst*[acodec=none]
wv*、 :选择包含视频的最差质量格式。它还可能包含音频。相当于
worstvideo*
worst*[vcodec!=none]
wa、 :选择质量最差的纯音频格式。相当于
worstaudio
worst*[vcodec=none]
wa*、 :选择包含音频的最差质量格式。它还可能包含视频。相当于
worstaudio*
worst*[acodec!=none]
例如,要下载质量最差的纯视频格式,你可以使用 .但是,建议不要使用相关选项。当你的格式选择器是 时,将选择在所有方面最差的格式。大多数时候,你真正想要的是文件大小最小的视频。所以一般最好使用或更严格地使用,而不是.有关详细信息,请参阅排序格式。
-f worstvideo
worst
worst
-S +size
-S +size,+br,+res,+fps
-f worst
你可以使用 选择类型的第 n 种最佳格式。例如,将选择第二最佳组合格式。同样,将选择包含视频流的第 3 种最佳格式。
best<type>.<n>
best.2
bv*.3
如果要下载多个视频,并且这些视频没有相同的可用格式,则可以使用斜杠指定首选项顺序。请注意,左侧的格式是首选;例如 如果可用,将下载格式 22,否则将下载格式 17(如果可用),否则将下载格式 18(如果可用),否则会抱怨没有合适的格式可供下载。
-f 22/17/18
如果要下载同一视频的多种格式,请使用逗号作为分隔符,例如 将下载所有这三种格式,当然,如果它们可用的话。或者结合优先级功能的更复杂的示例:。
-f 22,17,18
-f 136/137/mp4/bestvideo,140/m4a/bestaudio
你可以使用以下命令将多种格式的视频和音频合并为一个文件(需要安装 ffmpeg);例如 将下载最好的纯视频格式,最好的纯音频格式,并将它们与FFmpeg一起复用。
-f <format1>+<format2>+...
-f bestvideo+bestaudio
弃用警告:由于下面描述的行为很复杂且违反直觉,因此将删除此行为,并将在未来默认启用多流。将添加一个新的运算符,以将格式限制为单个音频/视频
除非使用,否则将忽略除第一种格式之外的所有具有视频流的格式。同样,除非使用,否则将忽略除第一种格式之外的所有具有音频流的格式。例如 将下载并合并所有 3 种给定格式。生成的文件将有 2 个视频流和 2 个音频流。但只会下载和合并和. 被忽略,因为已经选择了包含视频流 () 的另一种格式。因此,格式的顺序很重要。 将仅下载,而将忽略并仅下载。
--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
你还可以通过在括号中放置条件来过滤视频格式,如 (或者因为没有选择器的过滤器被解释为 )。
-f "best[height=720]"
-f "[filesize>10M]"
best
以下数值元字段可用于比较 、 、 、 (等于)、(不等于):
<
<=
>
>=
=
!=
filesize:字节数(如果事先知道)
filesize_approx:字节数的估计值
width:视频的宽度(如果已知)
height:视频的高度(如果已知)
aspect_ratio:视频的宽高比(如果已知)
tbr:音频和视频的平均比特率(以 KBit/s 为单位)
abr:平均音频比特率(以 KBit/s 为单位)
vbr:平均视频比特率(以 KBit/s 为单位)
asr:以赫兹为单位的音频采样率
fps:帧率
audio_channels:音频通道数
stretched_ratio:视频像素的像素,如果不是正方形
width:height
此外,还可以对比较(等于)、(开头为)、(结尾为)、(包含)、(匹配正则表达式)和以下字符串元字段进行过滤:
=
^=
$=
*=
~=
url:视频网址
ext:文件扩展名
acodec:正在使用的音频编解码器的名称
vcodec:正在使用的视频编解码器的名称
container:容器格式的名称
protocol:将用于实际下载的协议,小写(、、、、、或
http
https
rtsp
rtmp
rtmpe
mms
f4m
ism
http_dash_segments
m3u8
m3u8_native)
language: 语言代码
dynamic_range:视频的动态范围
format_id:格式的简短说明
format:人类可读的格式描述
format_note:有关格式的其他信息
resolution:宽度和高度的文字说明
任何字符串比较都可以以否定为前缀,以产生相反的比较,例如 (不包含)。如果字符串比较的比较包含空格或特殊字符,则需要用双引号或单引号括起来。
!
!*=
._-
注意:不保证上述任何元字段都存在,因为这完全取决于特定提取器获得的元数据,即网站提供的元数据。提取器提供的任何其他字段也可用于过滤。
除非在运算符后加上问号 (),否则将排除该值未知的格式。你可以组合格式过滤器,因此选择最大 720p 的视频(或高度未知的视频),比特率至少为 500 KBit/s。你还可以使用过滤器来下载满足过滤器的所有格式,例如 选择所有纯音频格式。
?
-f "bv[height<=?720][tbr>500]"
all
-f "all[vcodec=none]"
格式选择器也可以使用括号进行分组;例如 将下载高度低于 480 的最佳预合并 MP4 和 WebM 格式。
-f "(mp4,webm)[height<480]"
你可以使用 () 更改被视为 的条件。此内容的一般格式为 .
best
-S
--format-sort
--format-sort field1,field2...
可用字段包括:
hasvid:优先处理具有视频流的格式
hasaud:优先处理具有音频流的格式
ie_pref:格式首选项
lang:语言首选项
quality:格式的质量
source:源的首选项
proto:用于下载的协议 (
https/
ftps>
http/
ftp>
m3u8_native/
m3u8>
http_dash_segments>
websocket_frag>
mms/
rtsp>
f4f/
f4m)
vcodec: 视频编解码器 ( > > > > > > > > 其他)
av01
vp9.2
vp9
h265
h264
vp8
h263
theora
acodec:音频编解码器(/>/> > > > > > > > > >其他)
flac
alac
wav
aiff
opus
vorbis
aac
mp4a
mp3
ac4
eac3
ac3
dts
codec:相当于
vcodec,acodec
vext:视频扩展(> > > >其他)。如果使用,则首选。
mp4
mov
webm
flv
--prefer-free-formats
webm
aext:音频扩展(> > > > > >其他)。如果使用,则顺序更改为
m4a
aac
mp3
ogg
opus
webm
--prefer-free-formats
ogg>
opus>
webm>
mp3>
m4a>
aac
ext:相当于
vext,aext
filesize:确切的文件大小(如果事先知道)
fs_approx:近似文件大小
size:确切的文件大小(如果可用),否则为近似文件大小
height:视频高度
width:视频宽度
res:视频分辨率,按最小尺寸计算。
fps:视频帧率
hdr:视频的动态范围 (
DV>
HDR12>
HDR10+>
HDR10>
HLG>
SDR)
channels:音频通道数
tbr:总平均比特率(以 KBit/s 为单位)
vbr:平均视频比特率(以 KBit/s 为单位)
abr:平均音频比特率(以 KBit/s 为单位)
br:平均比特率(以 KBit/s 为单位),
tbr/
vbr/
abr
asr:音频采样率(以 Hz 为单位)
弃用警告:其中许多字段具有(当前未记录的)别名,这些别名可能会在将来的版本中删除。建议仅使用记录的字段名称。
除非另有说明,否则所有字段均按降序排序。要反转这种情况,请在字段前面加上 .例如 首选分辨率最小的格式。此外,还可以为字段添加首选值后缀,用 .例如 首选较大的视频,但不要大于 720p,如果没有低于 720p 的视频,则选择最小的视频。对于 和 ,可以提供两个首选值,第一个用于视频,第二个用于音频。例如 (等效于 )将视频编解码器首选项设置为 > > > > > > >,将音频编解码器首选项设置为 > > > > > > 。你还可以使用分隔符使排序首选最接近的值。例如 首选文件大小最接近 1 GiB 的格式。
+
+res
:
res:720
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
无论用户定义的顺序如何,字段 和 始终在排序中被赋予最高优先级。可以使用 更改此行为。除此之外,使用的默认顺序是:.提取程序可以覆盖此默认顺序,但不能覆盖用户提供的顺序。
hasvid
ie_pref
--format-sort-force
lang,quality,res,fps,hdr:12,vcodec:vp9.2,channels,acodec,size,br,asr,proto,ext,hasaud,source,id
请注意,默认值为 ;即 不是首选。同样,hdr 的默认值为 ;即杜比视界不是首选。之所以做出这些选择,是因为 DV 和 AV1 格式尚未与大多数设备完全兼容。随着越来越多的设备能够流畅地播放这些格式,这种情况将来可能会改变。
vcodec:vp9.2
av1
hdr:12
如果格式选择器是 ,则在排序后选择最后一项。这意味着它将选择在所有方面最差的格式。大多数时候,你真正想要的是文件大小最小的视频。所以一般比较好用。
worst
-f best -S +size,+br,+res,+fps
提示:你可以使用 查看格式的排序方式(从最差到最好)。
-v -F
# Download and merge the best video-only format and the best audio-only format,
# or download the best combined format if video-only format is not available
$ yt-dlp -f "bv+ba/b"
# Download best format that contains video,
# and if it doesn't already have an audio stream, merge it with best audio-only format
$ yt-dlp -f "bv*+ba/b"
# Same as above
$ yt-dlp
# Download the best video-only format and the best audio-only format without merging them
# For this case, an output template should be used since
# by default, bestvideo and bestaudio will have the same file name.
$ yt-dlp -f "bv,ba" -o "%(title)s.f%(format_id)s.%(ext)s"
# Download and merge the best format that has a video stream,
# and all audio-only formats into one file
$ yt-dlp -f "bv*+mergeall[vcodec=none]" --audio-multistreams
# Download and merge the best format that has a video stream,
# and the best 2 audio-only formats into one file
$ yt-dlp -f "bv*+ba+ba.2" --audio-multistreams
# The following examples show the old method (without -S) of format selection
# and how to use -S to achieve a similar but (generally) better result
# Download the worst video available (old method)
$ yt-dlp -f "wv*+wa/w"
# Download the best video available but with the smallest resolution
$ yt-dlp -S "+res"
# Download the smallest video available
$ yt-dlp -S "+size,+br"
# Download the best mp4 video available, or the best video if no mp4 available
$ yt-dlp -f "bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b"
# Download the best video with the best extension
# (For video, mp4 > mov > webm > flv. For audio, m4a > aac > mp3 ...)
$ yt-dlp -S "ext"
# Download the best video available but no better than 480p,
# or the worst video if there is no video under 480p
$ yt-dlp -f "bv*[height<=480]+ba/b[height<=480] / wv*+ba/w"
# Download the best video available with the largest height but no better than 480p,
# or the best video with the smallest resolution if there is no video under 480p
$ yt-dlp -S "height:480"
# Download the best video available with the largest resolution but no better than 480p,
# or the best video with the smallest resolution if there is no video under 480p
# Resolution is determined by using the smallest dimension.
# So this works correctly for vertical videos as well
$ yt-dlp -S "res:480"
# Download the best video (that also has audio) but no bigger than 50 MB,
# or the worst video (that also has audio) if there is no video under 50 MB
$ yt-dlp -f "b[filesize<50M] / w"
# Download largest video (that also has audio) but no bigger than 50 MB,
# or the smallest video (that also has audio) if there is no video under 50 MB
$ yt-dlp -f "b" -S "filesize:50M"
# Download best video (that also has audio) that is closest in size to 50 MB
$ yt-dlp -f "b" -S "filesize~50M"
# Download best video available via direct link over HTTP/HTTPS protocol,
# or the best video available via any protocol if there is no such video
$ yt-dlp -f "(bv*+ba/b)[protocol^=http][protocol!*=dash] / (bv*+ba/b)"
# Download best video available via the best protocol
# (https/ftps > http/ftp > m3u8_native > m3u8 > http_dash_segments ...)
$ yt-dlp -S "proto"
# Download the best video with either h264 or h265 codec,
# or the best video if there is no such video
$ yt-dlp -f "(bv*[vcodec~='^((he|a)vc|h26[45])']+ba) / (bv*+ba/b)"
# Download the best video with best codec no better than h264,
# or the best video with worst codec if there is no such video
$ yt-dlp -S "codec:h264"
# Download the best video with worst codec no worse than h264,
# or the best video with best codec if there is no such video
$ yt-dlp -S "+codec:h264"
# More complex examples
# Download the best video no better than 720p preferring framerate greater than 30,
# or the worst video (still preferring framerate greater than 30) if there is no such video
$ yt-dlp -f "((bv*[fps>30]/bv*)[height<=720]/(wv*[fps>30]/wv*)) + ba / (b[fps>30]/b)[height<=720]/(w[fps>30]/w)"
# Download the video with the largest resolution no better than 720p,
# or the video with the smallest resolution available if there is no such video,
# preferring larger framerate for formats with the same resolution
$ yt-dlp -S "res:720,fps"
# Download the video with smallest resolution no worse than 480p,
# or the video with the largest resolution available if there is no such video,
# preferring better codec and then larger total bitrate for the same resolution
$ yt-dlp -S "+res:480,codec,br"
提取器获取的元数据可以通过使用 和
--parse-metadata
--replace-in-metadata
--replace-in-metadata FIELDS REGEX REPLACE用于使用 Python 正则表达式替换任何元数据字段中的文本。反向引用可用于替换字符串以供高级使用。
的一般语法是给出要从中提取数据的字段或输出模板的名称,以及将其解释为的格式,用冒号分隔。具有命名捕获组、单个字段名称或与输出模板类似的语法(仅支持格式设置)的 python 正则表达式可用于 。该选项可以多次用于解析和修改各种字段。
--parse-metadata FROM:TO
:
%(field)s
TO
请注意,这些选项保留其相对顺序,允许在解析的字段中进行替换,反之亦然。此外,这样创建的任何字段都可以在输出模板中使用,并且还会影响使用 时添加的媒体文件的元数据。
--embed-metadata
此选项还具有一些特殊用途:
你可以根据当前下载的视频的元数据下载其他 URL。为此,请将该字段设置为要下载的 URL。例如 将下载描述中找到的第一个Vimeo视频
additional_urls
--parse-metadata "description:(?P<additional_urls>https?://www\.vimeo\.com/\d+)"
你可以使用它来更改嵌入在媒体文件中的元数据。为此,请使用前缀设置相应字段的值。例如,你设置为字段的任何值都将添加到文件中的字段中 - 你可以使用它来设置不同的“描述”和“概要”。要修改单个流的元数据,请使用前缀(例如)。设置为该字段的任何值都将覆盖所有默认值。
meta_
meta_description
description
meta<n>_
meta1_language
meta_
注意:元数据修改发生在格式选择、后提取和其他后处理操作之前。在这些步骤中,可能会添加或更改某些字段,从而覆盖你的更改。
作为参考,这些是 yt-dlp 默认添加到文件元数据中的字段:
元数据字段 | 从 |
---|---|
title |
track或 title |
date |
upload_date |
description, synopsis |
description |
purl, comment |
webpage_url |
track |
track_number |
artist |
artist或 creator uploader uploader_id |
genre |
genre |
album |
album |
album_artist |
album_artist |
disc |
disc_number |
show |
series |
season_number |
season_number |
episode_id |
episode或 episode_id |
episode_sort |
episode_number |
language每个流 |
格式的language |
注意:文件格式可能不支持其中的某些字段
# Interpret the title as "Artist - Title"
$ yt-dlp --parse-metadata "title:%(artist)s - %(title)s"
# Regex example
$ yt-dlp --parse-metadata "description:Artist - (?P<artist>.+)"
# Set title as "Series name S01E05"
$ yt-dlp --parse-metadata "%(series)s S%(season_number)02dE%(episode_number)02d:%(title)s"
# Prioritize uploader as the "artist" field in video metadata
$ yt-dlp --parse-metadata "%(uploader|)s:%(meta_artist)s" --embed-metadata
# Set "comment" field in video metadata using description instead of webpage_url,
# handling multiple lines correctly
$ yt-dlp --parse-metadata "description:(?s)(?P<meta_comment>.+)" --embed-metadata
# Do not set any "synopsis" in the video metadata
$ yt-dlp --parse-metadata ":(?P<meta_synopsis>)"
# Remove "formats" field from the infojson by setting it to an empty string
$ yt-dlp --parse-metadata "video::(?P<formats>)" --write-info-json
# Replace all spaces and "_" in title and uploader with a `-`
$ yt-dlp --replace-in-metadata "title,uploader" "[ _]" "-"
一些提取器接受可以使用 传递的其他参数。 是 的(分号)分隔字符串。例如
--extractor-args KEY:ARGS
ARGS
;
ARG=VAL1,VAL2
--extractor-args "youtube:player-client=android_embedded,web;include_live_dash" --extractor-args "funimation:version=uncut"
注意:在CLI中,可以使用代替;例如 成为
ARG
-
_
youtube:player-client"
youtube:player_client"
以下提取程序使用此功能:
lang:首选此语言代码的已翻译元数据(等)(区分大小写)。默认情况下,首选视频主要语言元数据,并回退到已翻译。有关支持的内容语言代码列表,请参阅 youtube.py
title
description
en
skip:一个或多个,或分别跳过提取 m3u8 清单、破折号清单和自动翻译的字幕
hls
dash
translated_subs
player_client:要从中提取视频数据的客户端。主要客户端是 ,和变体 , , , (e.g. );和 和 (agegate 旁路),没有变体。默认情况下,会使用,但会根据需要为年龄限制视频添加变体。同样,为 url 添加了音乐变体。你可以使用所有客户端和默认客户端。
web
android
ios
_music
_embedded
_embedscreen
_creator
web_embedded
mweb
mweb_embedscreen
tv_embedded
ios,android,web
tv_embedded
creator
music.youtube.com
all
default
player_skip:跳过一些可靠提取通常需要的网络请求。(跳过客户端配置)、(跳过初始网页)、(跳过 js 播放器)中的一个或多个。虽然这些选项可以帮助减少所需的请求数或避免某些速率限制,但它们可能会导致一些问题。有关详细信息,请参见 #860
configs
webpage
js
player_params:用于播放器请求的 YouTube 播放器参数。将覆盖 yt-dlp 设置的任何默认值。
comment_sort:或(默认) - 选择评论排序模式(在YouTube方面)
top
new
max_comments:限制要收集的评论数量。以逗号分隔的整数列表,表示 。默认值为
max-comments,max-parents,max-replies,max-replies-per-thread
all,all,all,all
all,all,1000,10
1000,all,100
formats:更改要返回的格式类型。 (将 HTTP 转换为 DASH)、(内容相同但 URL 或协议不同;包括)、(无法完全下载 - 实时 dash 和后期 m3u8)
dashy
duplicate
dashy
incomplete
innertube_host:用于所有 API 请求的 Innertube API 主机;例如,.请注意,从一个子域导出的 cookie 不适用于其他子域
studio.youtube.com
youtubei.googleapis.com
innertube_key:用于所有 API 请求的 Innertube API 密钥
raise_incomplete_data:引发错误而不是报告警告
Incomplete Data Received
skip:一个或多个(跳过初始网页下载)、(允许在未下载初始网页时下载需要身份验证的播放列表。这可能会导致不需要的行为,有关详细信息,请参阅 #1122)
webpage
authcheck
approximate_date:提取近似值和平面播放列表。这可能会导致基于日期的筛选器略微关闭
upload_date
timestamp
fragment_query:如果未提供任何值,则将 mpd/m3u8 清单 URL 中的任何查询传递到其片段,否则应用作为 的查询字符串。不适用于ffmpeg
fragment_query=VALUE
variant_query:如果未提供任何值,则将主 m3u8 URL 查询传递到其变体播放列表 URL,或者应用给定的查询字符串
variant_query=VALUE
hls_key:HLS AES-128 密钥 URI 或密钥(十六进制),以及可选的 IV(十六进制),格式为 ;例如。传递这些值中的任何一个都将强制使用本机 HLS 下载器,并覆盖在 m3u8 播放列表中找到的相应值
(URI|KEY)[,IV]
generic:hls_key=ABCDEF1234567980,0xFEDCBA0987654321
is_live:绕过实时 HLS 检测并手动设置 - 将设置的值,任何其他值(或无值)将设置
live_status
false
not_live
is_live
language:要提取的音频语言,例如
funimation:language=english,japanese
version:要提取的视频版本 - 或
uncut
simulcast
format:要提取的流类型(默认值:)。可能有用的值包括 、 、 、 、 、 、
adaptive_hls
adaptive_hls
adaptive_dash
vo_adaptive_hls
vo_adaptive_dash
download_hls
download_dash
multitrack_adaptive_hls_v2
hardsub:要提取的 hardsub 版本的优先顺序,或(默认值:= no hardsubs),例如
all
None
crunchyrollbeta:hardsub=en-US,None
video_types:要下载的视频类型 - 一个或多个 、 、 、
episodes
movies
clips
trailers
segment_duration:HLS-DMC 格式的分段持续时间(以毫秒为单位)。使用它的风险由你自己承担,因为此功能可能会导致你的帐户终止。
check_all:尝试以更多请求为代价检查更多。一个或多个 ,
thumbnails
captures
comment_sort:(默认)、(需要 cookie)、、 - 选择评论排序模式(在 GameJolt 方面)
hot
you
top
new
res:要忽略的分辨率 - 一个或多个 , ,
sd
hd
fhd
vcodec:要忽略的 vcodec - 一个或多个 , ,
h264
h265
dvh265
dr:要忽略的动态范围 - 一个或多个 , ,
sdr
hdr10
dv
max_comments:要提取的最大注释数 - 默认值为
120
api_hostname:用于移动 API 请求的主机名,例如
api-h2.tiktokv.com
app_version:调用移动 API 的应用程序版本 - 应与 一起设置,例如
manifest_app_version
20.2.1
manifest_app_version:用于调用移动 API 的数字应用程序版本,例如
221
tab:要下载的选项卡 - 、、、、、
new
top
videos
podcasts
streams
stacks
api:选择其中之一(默认),或作为推文提取的 API。登录后无效
graphql
legacy
syndication
device_id:由网站分配的 UUID 值,用于对付费直播内容强制执行设备限制。可以在浏览器本地存储中找到
client_id:要随 GraphQL 请求一起发送的客户端 ID 值,例如
twitch:client_id=kimne78kx3ncx6brgo4mv6wki5h1ko
area:要提取的区域变异。有效区域为:、、、、、。默认为
sapporo
sendai
tokyo
nagoya
osaka
hiroshima
matsuyama
fukuoka
tokyo
type:要提取的游戏回放类型。有效类型为:、 和 。你可以使用提取所有可用的重播类型,这是默认设置
full_game
full_game_spanish
condensed_game
all_22
all
bitrate:要请求的音频比特率。、、、。默认值为
16
32
64
128
320
128,320
注意:这些选项将来可能会更改/删除,而不用担心向后兼容性
请注意,即使未调用,也会导入所有插件,并且不会对插件代码执行任何检查。使用插件的风险由你自己承担,并且只有在你信任代码的情况下!
插件可以是 s 或 .
<type>
extractor
postprocessor
--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
请参阅 wiki 了解一些已知的插件
可以使用各种方法和位置安装插件。
配置目录: 插件包(包含命名空间文件夹)可以放入以下标准配置位置:
yt_dlp_plugins
${XDG_CONFIG_HOME}/yt-dlp/plugins/<package name>/yt_dlp_plugins/(推荐在 Linux/macOS 上使用)
${XDG_CONFIG_HOME}/yt-dlp-plugins/<package name>/yt_dlp_plugins/
${APPDATA}/yt-dlp/plugins/<package name>/yt_dlp_plugins/(推荐在 Windows 上)
${APPDATA}/yt-dlp-plugins/<package name>/yt_dlp_plugins/
~/.yt-dlp/plugins/<package name>/yt_dlp_plugins/
~/yt-dlp-plugins/<package name>/yt_dlp_plugins/
/etc/yt-dlp/plugins/<package name>/yt_dlp_plugins/
/etc/yt-dlp-plugins/<package name>/yt_dlp_plugins/
可执行文件位置:插件包同样可以安装在可执行文件位置下的目录中(建议用于可移植安装):
yt-dlp-plugins
<root-dir>/yt-dlp.exe
<root-dir>/yt-dlp-plugins/<package name>/yt_dlp_plugins/
<root-dir>/yt_dlp/__main__.py
<root-dir>/yt-dlp-plugins/<package name>/yt_dlp_plugins/
pip 和 PYTHONPATH 中的其他位置
pip
PYTHONPATH
yt_dlp_plugins
.zip,并且还支持在其根目录中包含命名空间文件夹的存档作为插件包。
.egg
.whl
yt_dlp_plugins
${XDG_CONFIG_HOME}/yt-dlp/plugins/mypluginpkg.zip
mypluginpkg.zip
yt_dlp_plugins/<type>/myplugin.py
运行 yt-dlp with 以检查插件是否已加载。
--verbose
有关模板插件包,请参阅 yt-dlp-sample-plugins 存储库,有关插件开发指南,请参阅 wiki 的插件开发部分。
名称以 / 结尾的所有公共类都会从每个文件中导入,供提取器和后处理器使用。这尊重下划线前缀(例如 是私有的)和 .同样,可以通过在模块名称前面加上下划线来排除模块(例如 )。
IE
PP
_MyBasePluginIE
__all__
_myplugin.py
要将现有提取器替换为 1 的子类,请设置 class 关键字参数(例如 将替换为 )。由于提取器替换了父类,因此应使用上述方法之一将子类提取器设为私有,从而排除单独导入子类提取器。
plugin_name
class MyPluginIE(ABuiltInIE, plugin_name='myplugin')
ABuiltInIE
MyPluginIE
如果你是插件作者,请将 yt-dlp-plugins 作为主题添加到你的存储库中,以便于发现。
请参阅开发人员说明,了解如何编写和测试提取器。
yt-dlp 尽最大努力成为一个好的命令行程序,因此应该可以从任何编程语言调用。
程序应避免解析正常的 stdout,因为它们可能会在将来的版本中更改。相反,它们应使用 、 、 等选项来创建可以可靠地重现和分析的控制台输出。
-J
--progress-template
--exec
在 Python 程序中,你可以以更强大的方式嵌入 yt-dlp,如下所示:
from yt_dlp import YoutubeDL
URLS = ['https://www.youtube.com/watch?v=BaW_jenozKc']
with YoutubeDL() as ydl:
ydl.download(URLS)
最有可能的是,你需要使用各种选项。有关可用选项的列表,请查看 yt_dlp/YoutubeDL
.py 或在 Python shell 中。如果你已经熟悉 CLI,则可以使用 devscripts/cli_to_api.py
将任何 CLI 开关转换为参数。
help(yt_dlp.YoutubeDL)
YoutubeDL
提示:如果你将代码从 youtube-dl 移植到 yt-dlp,需要注意的一点是,我们不保证 的返回值是 json 可序列化的,甚至不保证是字典。它将类似于字典,但如果要确保它是可序列化的字典,请传递它,如下例所示
YoutubeDL.extract_info
YoutubeDL.sanitize_info
import json
import yt_dlp
URL = 'https://www.youtube.com/watch?v=BaW_jenozKc'
# ℹ️ 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=BaW_jenozKc']
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=BaW_jenozKc']
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=BaW_jenozKc']
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=BaW_jenozKc']
# ℹ️ 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=BaW_jenozKc']
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)
这些都是已弃用的选项和当前实现相同效果的替代方案
虽然这些选项与新的选项几乎相同,但存在一些差异,使它们无法冗余
-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
虽然这些选项是多余的,但由于它们的易用性,它们仍然被期望使用
--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-filter "title ~= (?i)REGEX" --reject-title REGEX --match-filter "title !~= (?i)REGEX" --min-views COUNT --match-filter "view_count >=? COUNT" --max-views COUNT --match-filter "view_count <=? COUNT" --break-on-reject Use --break-match-filter --user-agent UA --add-header "User-Agent:UA" --referer URL --add-header "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 Use string formatting, e.g. %(autonumber)03d --autonumber-start NUMBER Use internal field formatting like %(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 (Alias: --no-list-formats-as-table) --list-formats-as-table --compat-options -list-formats [Default] (Alias: --no-list-formats-old) --youtube-skip-dash-manifest --extractor-args "youtube:skip=dash" (Alias: --no-youtube-include-dash-manifest) --youtube-skip-hls-manifest --extractor-args "youtube:skip=hls" (Alias: --no-youtube-include-hls-manifest) --youtube-include-dash-manifest Default (Alias: --no-youtube-skip-dash-manifest) --youtube-include-hls-manifest Default (Alias: --no-youtube-skip-hls-manifest) --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 Download only part of video for testing extractors --load-pages Load pages dumped by --write-pages --youtube-print-sig-code For testing youtube signatures --allow-unplayable-formats List unplayable formats also --no-allow-unplayable-formats Default
由于各种原因,这些别名不再记录在案
--avconv-location --ffmpeg-location --clean-infojson --clean-info-json --cn-verification-proxy URL --geo-verification-proxy URL --dump-headers --print-traffic --dump-intermediate-pages --dump-pages --force-write-download-archive --force-write-archive --load-info --load-info-json --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 的支持已被弃用,取而代之的是这些选项
--sponsorblock
--sponskrub --sponsorblock-mark all --no-sponskrub --no-sponsorblock --sponskrub-cut --sponsorblock-remove all --no-sponskrub-cut --sponsorblock-remove -all --sponskrub-force Not applicable --no-sponskrub-force Not applicable --sponskrub-location Not applicable --sponskrub-args Not applicable
这些选项可能不再按预期工作
--prefer-avconv avconv is not officially supported by yt-dlp (Alias: --no-prefer-ffmpeg) --prefer-ffmpeg Default (Alias: --no-prefer-avconv) -C, --call-home Not implemented --no-call-home Default --include-ads No longer supported --no-include-ads Default --write-annotations No supported site has annotations now --no-write-annotations Default --compat-options seperate-video-versions No longer needed
这些选项自 2014 年以来已弃用,现已完全删除
-A, --auto-number -o "%(autonumber)s-%(id)s.%(ext)s" -t, -l, --title, --literal -o "%(title)s-%(id)s.%(ext)s"
有关打开问题和向项目贡献代码的说明,请参阅 CONTRIBUTING.md
有关更多信息,请参见 Wiki