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

Reynard Asis picture Reynard Asis · Feb 26, 2016 · Viewed 11.2k times · Source
**

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. **

Answer

anon picture anon · Feb 26, 2016

outtmpl can contain directory names, simply set

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