活到老学到老之yt-dlp_macos(二)

关于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了!

相关推荐
未来侦察班2 小时前
一晃13年过去了,苹果的Airdrop依然很坚挺。
macos·ios·苹果vision pro
普通网友7 小时前
苹果笔记本(Mac)连接手机完全指南
macos·智能手机
Aftery的博客9 小时前
Xcode运行报错:SDK does not contain ‘libarclite‘ at the path
macos·cocoa·xcode
楚轩努力变强16 小时前
iOS 自动化环境配置指南 (Appium + WebDriverAgent)
javascript·学习·macos·ios·appium·自动化
猫头虎1 天前
如何解决 OpenClaw “Pairing required” 报错:两种官方解决方案详解
网络·windows·网络协议·macos·智能路由器·pip·scipy
皮卡车厘子2 天前
Mac 挂载目录
macos
良逍Ai出海3 天前
在 Windows & macOS 上安装 Claude Code,并使用第三方 Key 的完整教程
windows·macos
热爱生活的五柒3 天前
linux/mac/wsl如何使用claude code,并配置免费的硅基流动API?(官方的需要付费订阅)
linux·运维·macos
胖胖大王叫我来巡山3 天前
mac本地安装DataEase桌面版
macos
奋斗者1号3 天前
OpenClaw 部署方式对比:云端、WSL、Mac 本机、Ubuntu 虚拟机(2026年2月最新主流实践)
linux·ubuntu·macos