Philip Kirkbride
Philip Kirkbride

Reputation: 22899

youtube-dl specify output from python script?

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.

Upvotes: 0

Views: 3509

Answers (1)

anon
anon

Reputation:

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.

Upvotes: 5

Related Questions