how to set up default download location in youtube-dl

后端 未结 6 1193
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-30 09:16

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

6条回答
  •  误落风尘
    2021-01-30 09:37

    This is the EXACT ANOTHER USEFUL method to download your video into a desired DIRECTORY, and also keep the native filename of the download.

    1. Decide where you want to create a configuration file.
    2. Create a file, "youtube-dl.conf". You can create a youtube-dl.txt first it it's easier, but the file must be "youtube-dl.conf".
    3. Here is a basic sample of a config file: this is where you want your downloads to go. This is all you have to put into the file. Where -o is the flag, %userprofile%/Desktop/DL/ is where I want the download to go, and %(title)s-%(id)s.%(ext)s is the command to keep the native filename.

      This is your config file below:

    -o %userprofile%/Desktop/DL/%(title)s-%(id)s.%(ext)s

    Options found here Config here

    1. The command paramaters:
      %program% -f %option% "%youtubelink%" "%MYCONFIG%" "%MYPATH%"

    Batch File setup:

    ::Variables:
    Set program="%USERPROFILE%\Desktop\YOUTUBE-DL\v20201209\youtube-dl.exe"
    Set option=best
    SET MYPATH="%USERPROFILE%\Desktop\YOUTUBE-DL\v20201209\config"
    SET MYCONFIG="--config-location"
    SET MYDLDIR="%USERPROFILE%\Desktop\DL"
    SET INSTR='%%(title)s-%%(id)s.%%(ext)s'
    MKDIR "%USERPROFILE%\Desktop\DL"
    
    ::Ask user for input.
    Set /P youtubelink=[Past Link]:
    
    :: For use of config file, for default download location.
    %program% -f %option% "%youtubelink%" "%MYCONFIG%" "%MYPATH%"
    
    :: There are many ways to accomplish this:
    :: For Batch File, NOTE extra (%) character needed.
    :: "%program%" -f "option" --merge-output-format mp4 -o "%MYDLDIR%"\%%(title)s-%%(id)s.%%(ext)s %youtubelink%
    :: or this use of variable
    :: "%program%" -f "option" --merge-output-format mp4 -o "%MYDLDIR%"\%INSTR% %youtubelink%
    

    NOTE: The use of "quotes" when there are spaces in your variable options.

    Final Message:
    Create the config file, put it in a folder (directory) that you wish to refer to it. Go to your youtube-dl.exe file and pass the "parameters" listed above to it using your CMD or a batch file. Done. (contribution, and being kind)

提交回复
热议问题