0

I'm following the documentation on using youtube-dl from a python script.

But I can't seem to get the output option, specifying the folder I want the download to go into to work:

ydl_opts = {'output':'video'}                                                                                                                           
with youtube_dl.YoutubeDL(ydl_opts) as ydl:                                                                                                         
  ydl.download([url])

I've also tried replacing output with o and -o.

1 Answer 1

5

outtmpl (not output) is a template for the video file name, not a directory. An output template value of 'video' instructs youtube-dl to write the video a file literally called video. Try something like

ydl_opts = {
    'outtmpl': '/home/philip/my/videos/%(title)s-%(id)s.%(ext)s',
}

If you want to know the name of further options, have a look at the list of options. For more information on the output template, refer to the documentation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.