how to set directory in ydl_opts in using youtube-dl in python?

烈酒焚心 提交于 2020-07-04 13:25:28

问题


**

What do i need to add to specify that all the download mp3 will go to this directory: 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],

}

if i understand it correctly outtmpl is for the template of the name of output file. **


回答1:


outtmpl can contain directory names, simply set

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


来源:https://stackoverflow.com/questions/35643757/how-to-set-directory-in-ydl-opts-in-using-youtube-dl-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!