关于yt-dlp_macos的第一篇文章,请参考:https://blog.csdn.net/zhang_jiamin/article/details/147050835?spm=1011.2415.3001.5331
今天使用过程中提示:zsh: no matches found
bash
jasper.zhang@localhost yt-download % yt-dlp_macos --cookies www.youtube.com_cookies.txt -f mp4 https://www.youtube.com/watch?v=xxxxxxx
zsh: no matches found: https://www.youtube.com/watch?v=xxxxxxx
zsh: no matches found 的原因是 zsh (Z Shell)把URL 中的 ? 符号解释为通配符的一部分,从而导致 shell 尝试匹配文件或路径。
解决:用 单引号 或 双引号 将 URL 括起来:
bash
jasper.zhang@localhost yt-download % yt-dlp_macos --cookies www.youtube.com_cookies.txt -f mp4 "https://www.youtube.com/watch?v=xxxxxxx"
再次执行后提示:
bash
jasper.zhang@localhost yt-download % yt-dlp_macos --cookies www.youtube.com_cookies.txt -f mp4 "https://www.youtube.com/watch?v=xxxxxxx"
WARNING: Your yt-dlp version (2025.08.11) is older than 90 days!
It is strongly recommended to always use the latest version.
Run "yt-dlp --update" or "yt-dlp -U" to update.
To suppress this warning, add --no-update to your command/config.
[youtube] Extracting URL: https://www.youtube.com/watch?v=xxxxxxxx
[youtube] xxxxxxxx: Downloading webpage
[youtube] xxxxxxxx: Downloading tv client config
[youtube] xxxxxxxx: Downloading player 7d647a07-main
[youtube] xxxxxxxx: Downloading tv player API JSON
ERROR: [youtube] xxxxxxxx: The following content is not available on this app.. Watch on the latest version of YouTube.
于是更新版本:
bash
jasper.zhang@localhost yt-download % yt-dlp_macos --update
Current version: stable@2025.08.11 from yt-dlp/yt-dlp
Latest version: stable@2025.11.12 from yt-dlp/yt-dlp
Current Build Hash: 8001c730007495a26de24d7fcf6c72e76bc24c47bdde2cfd86d51e21626bd7e4
Updating to stable@2025.11.12 from yt-dlp/yt-dlp ...
Updated yt-dlp to stable@2025.11.12 from yt-dlp/yt-dlp
最新版本为:
bash
jasper.zhang@localhost yt-download % yt-dlp_macos --version
2025.11.12
The following content is not available on this app.. Watch on the latest version of YouTube. 通常表示正在尝试下载的 YouTube 视频受到了地区、账户或 YouTube 版本的限制。于是尝试在下载时模拟浏览器访问:
bash
jasper.zhang@localhost yt-download % yt-dlp_macos --cookies www.youtube.com_cookies.txt -f mp4 --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" "https://www.youtube.com/watch?v=xxxxxxxx"
执行后可以下载成功,但还是有warning:
bash
WARNING: "-f mp4" selects the best pre-merged mp4 format which is often not what's intended.
Pre-merged mp4 formats are not available from all sites, or may only be available in lower quality.
To prioritize the best h264 video and aac audio in an mp4 container, use "-t mp4" instead.
If you know what you are doing and want a pre-merged mp4 format, use "-f b[ext=mp4]" instead to suppress this warning
为了优先选择 最佳 H.264 视频和 AAC 音频 格式,应该使用 -t mp4:
bash
jasper.zhang@localhost yt-download % yt-dlp_macos --cookies www.youtube.com_cookies.txt -t mp4 --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" "https://www.youtube.com/watch?v=xxxxxxxx"
这样就OK了!