Search code examples
terminalyoutube-dl

How to download youtube video in current working directory with youtube-dl


How do I download files in the current working directory with youtube-dl?

I want something like youtube-dl -o pwd "https://www.youtube.com/watch?v=UGHVseYRXDo" to work.

My config currently looks like:

-o ~/Downloads/%(title)s-%(id)s.%(ext)s
--format mp4

I'd like to retain the file name and format properties, but change the download location to wherever pwd is.


Solution

  • The option -o filename is optional, and you don't have to specify the working directory as this is the default one. But if you prefer to specify it, you could use a command substitution `pwd` or $(pwd) so your command could be eg:

    $ youtube-dl -o "$(pwd)/%(title)s.%(ext)s" url
    

    Of course you are free to put any other options like those in your configuration file.