如何修复 youtube-dl 错误:无法打开以进行写入:[Errno 21] 是目录吗?

sam*_*ami 7 youtube-dl

我正在尝试将youtube-dl视频从 youtube 下载到目录,但会弹出此错误:

$ youtube-dl -o ~/Videos http://www.youtube.com/watch?v=P0YiWsAM0O8
[youtube] P0YiWsAM0O8: Downloading webpage
[youtube] P0YiWsAM0O8: Downloading video info webpage
[youtube] P0YiWsAM0O8: Extracting video information
[youtube] P0YiWsAM0O8: Downloading MPD manifest
WARNING: Your copy of avconv is outdated and unable to properly mux separate video and audio files, youtube-dl will download single file media. Update avconv to version 10-0 or newer to fix this.
ERROR: unable to open for writing: [Errno 21] Is a directory: '/home/sami/Videos
Run Code Online (Sandbox Code Playgroud)

我正在运行 Ubuntu 14.04 和youtube-dl2017.06.05 版本

Gra*_*ent 8

-o选项告诉youtube-dl如何格式化视频的目标路径和名称(不仅是目录)。有点违反直觉。

youtube-dl(1) 自述文件手册

-o, --output TEMPLATE

输出文件名模板,有关所有信息,请参阅“输出模板”

所以你需要这样的东西:

youtube-dl -o "$HOME/Videos/%(title)s.%(ext)s" 'http://www.youtube.com/watch?v=P0YiWsAM0O8'
Run Code Online (Sandbox Code Playgroud)

指定除默认值之外的其他内容%(title)s-%(id)s.%(ext)s。我猜你很可能只想进入你的~/Videos文件夹并在youtube-dl那里没有选项地运行。

  • 顺便说一句,默认的输出路径模式是`%(title)s-%(id)s.%(ext)s`。 (2认同)