Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set up default download location in youtube-dl

how can I set default download location in youtube-dl so that everything that I download with youtube-dl goes into that default directory?

like image 945
user101 Avatar asked Sep 09 '15 14:09

user101


People also ask

How do I change download location for youtube-dl?

By default youtube-dl downloads files in the same directory from where you run the command. Mostly it's your home directory. If your name is Tom, then it is /home/Tom. To force it to download elsewhere you should use -o option; and to select quality of video, there is -f option.

Can youtube-dl download videos from other sites?

YouTube-dl is a free and open-source command-line program for Windows, macOS, and Linux. You can use it to download videos from YouTube and other online video services. YouTube-dl can download videos from over 700 websites with videos.


1 Answers

You need to use the -o switch with the Configuration file

Output on youtube-dl is handled with the --output or -o switch; pass it as an option, followed by the destination you want to save your downloads to:

youtube-dl -o '%USERPROFILE%\Desktop\%(title)s-%(id)s.%(ext)s' www.youtube.com/link/to/video

Note that -o has a dual function in that it also sets a template for how your output files will be named, using variables. In this example, it will output the title of the original downloaded video followed by the file extension, which is my personal preference. For all of the variables that can be used in a filename, have a look at the youtube-dl documentation here.

youtube-dl also allows use of a configuration file - a file that can be used to configure the switches you most frequently use so the program can pull them from there instead, saving you from having to explicitly call them each time you run it. This is what you'll need for the default download location that you're looking for. The configuration file can be used to set a default output destination so that you never have to explicitly set an output again.

To set up a configuration file for youtube-dl, assuming you have Windows:

  1. In %APPDATA%\Roaming, create a youtube-dl folder if one doesn't already exist.

  2. Inside that folder, create a plain text file named config.txt.

  3. Place youtube-dl options in the file as you'd normally use them on the command line with youtube-dl, placing each one on a new line. For example, for the output switch, you'd use: -o %USERPROFILE%\Desktop. For more on the Configuration file, read the documentation on it here.

Overriding the Configuration file

Even when an option is configured in a configuration file, it can be overridden by calling it explicitly from the command line. So, if you have -o set in a configuration file to be the default location for downloads, but want to save downloads to somewhere else for a current job, simply calling -o on the command line will override the configuration file for the current run of the program only.

like image 59
Hashim Aziz Avatar answered Sep 22 '22 18:09

Hashim Aziz