活到老学到老之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了!

相关推荐
denggun123451 天前
卡顿监测原理
macos·ios·xcode
Sheffi661 天前
iOS 触摸事件完整传递链路:Hit-Test 全流程深度解析
macos·ios·cocoa
ChineHe1 天前
Gin框架入门篇002_第一个Gin服务
macos·xcode·gin
Roc.Chang1 天前
解决 macOS 26.1 The application “xxxx” can’t be opened. 问题
macos
赶路人儿1 天前
从intel mac迁移到M3后软件的兼容性
macos
颜淡慕潇1 天前
Podman 从0到1使用教程(macOS 系统):安装 MySQL、Redis 容器
mysql·macos·podman
Niap.pr1 天前
Macos下访问树莓派系统(ext4)
macos
芳草萋萋鹦鹉洲哦1 天前
【mac】解决Apple无法验证“fsevents.node”是否包含可能危害Mac安全或泄漏隐私的恶意软件
安全·macos
aini_lovee2 天前
寻找 MAC 协议的 MATLAB 仿真
开发语言·macos·matlab
2501_915106322 天前
最新版本iOS系统设备管理功能全面指南
android·macos·ios·小程序·uni-app·cocoa·iphone