yt-dlp is a feature-rich command-line audio/video downloader with support for thousands of sites.
直接下载 release 文件,在 release 文件目录创建 yt-dlp.conf:
1 2 3 4 5
| --proxy socks5://127.0.0.1:7890 -o "E:/download/%(title)s.%(ext)s" --format mp4 -f bestvideo[ext=mp4]+bestaudio[ext=m4a] --no-mtime
|
其中-f bestvideo[ext=mp4]+bestaudio[ext=m4a] 是自动选取最佳画质的意思。可以使用yt-dlp -F https://xxx.com 查看所有可选媒体(音视频)。
新建批处理文件download.bat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| @echo off chcp 65001 setlocal EnableDelayedExpansion :InputLoop set /p "url=请输入YouTube链接地址: " if not "!url!"=="!url:https://=!" ( if exist "yt-dlp.exe" ( echo 正在下载...请稍等 yt-dlp.exe "!url!" echo 下载成功!!! ) else ( echo 错误:找不到yt-dlp.exe程序 ) pause goto :eof ) else ( echo 输入的链接不是有效的https地址,请重新输入! goto :InputLoop )
|
执行批处理文件输入链接即可下载。