**
我需要添加什么来指定所有下载的 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/