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

1

13
**

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

Largo answered 26/2, 2016 at 4:53 Comment(0)
C
30

outtmpl can contain directory names, simply set

'outtmpl': 'e:/python/downloadedsongs/%(title)s.%(ext)s',
Contingent answered 26/2, 2016 at 10:28 Comment(2)
How can we specify username and password?Scurf
@PrashantBhanarkar That's a separate question. Feel free to ask it on stackoverflow! Make sure you review the list of available options beforehand.Contingent

© 2022 - 2024 — McMap. All rights reserved.