gpt4 book ai didi

python-2.7 - 如何在 python 中使用 youtube-dl 在 ydl_opts 中设置目录?

转载 作者:行者123 更新时间:2023-12-04 13:22:28 36 4
gpt4 key购买 nike

**

我需要添加什么来指定所有下载的 mp3 都将转到此目录:e:/python/downloadedsongs
ydl_opts = {
'format': 'bestaudio/best',
'download_archive': 'downloaded_songs.txt',
'outtmpl': '%(title)s.%(ext)s',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
'logger': MyLogger(),
'progress_hooks': [my_hook],

}

如果我理解正确,outtmpl 是用于输出文件名称的模板。
**

最佳答案

outtmpl 可以包含目录名,只需设置

'outtmpl': 'e:/python/downloadedsongs/%(title)s.%(ext)s',

关于python-2.7 - 如何在 python 中使用 youtube-dl 在 ydl_opts 中设置目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35643757/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com