youtube-dl 指定 python 脚本的输出?
youtube-dl specify output from python script?
我正在关注 documentation 从 python 脚本中使用 youtube-dl
。
但我似乎无法获得输出选项,指定我希望下载文件进入的文件夹:
ydl_opts = {'output':'video'}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
我也试过用 o
和 -o
替换 output
。
outtmpl
(不是output
)是视频文件名的模板,不是目录。 'video'
的输出模板值指示 youtube-dl 将视频写入字面上称为视频的文件。试试像
ydl_opts = {
'outtmpl': '/home/philip/my/videos/%(title)s-%(id)s.%(ext)s',
}
如果您想知道更多选项的名称,请查看 the list of options. For more information on the output template, refer to the documentation。
我正在关注 documentation 从 python 脚本中使用 youtube-dl
。
但我似乎无法获得输出选项,指定我希望下载文件进入的文件夹:
ydl_opts = {'output':'video'}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
我也试过用 o
和 -o
替换 output
。
outtmpl
(不是output
)是视频文件名的模板,不是目录。 'video'
的输出模板值指示 youtube-dl 将视频写入字面上称为视频的文件。试试像
ydl_opts = {
'outtmpl': '/home/philip/my/videos/%(title)s-%(id)s.%(ext)s',
}
如果您想知道更多选项的名称,请查看 the list of options. For more information on the output template, refer to the documentation。