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

相关推荐
YongPagani17 小时前
Mac安装Homebrew
macos
Byron Loong18 小时前
【系统】Mac系统和Linux 指令对比
linux·macos·策略模式
软件小滔21 小时前
拖拽出来的专业感
经验分享·macos·mac·应用推荐
coooliang1 天前
Macos下载元神 ipa文件
macos
Benny的老巢1 天前
【n8n工作流入门02】macOS安装n8n保姆级教程:Homebrew与npm两种方式详解
macos·npm·node.js·n8n·n8n工作流·homwbrew·n8n安装
望眼欲穿的程序猿1 天前
基于Linux&MacOS 开发Ai8051U
linux·运维·macos
TESmart碲视1 天前
M4芯片MacBook支持多显示器吗?mac如何与KVM切换器使用。
macos·计算机外设·mst·kvm切换器·双屏kvm切换器
我的golang之路果然有问题1 天前
Mac 上的 Vue 安装和配置记录
前端·javascript·vue.js·笔记·macos
TheNextByte11 天前
如何将 iMessage 保存到外部硬盘驱动器
macos·objective-c·cocoa
青州从事5212 天前
20260108【mac】【brew】【docker】安装
macos·docker·eureka