I am creating a Java based GUI for the Windows exe version of youtube-dl .
The OUTPUT TEMPLATE portion of the README says that -o
can be used to set the save location and file name while downloading.
When I use the program through command line, I can set the download location as normal using youtube-dl.exe -o "C:\Users\<user>\Videos\%(title)s.%(ext)s" <youtube-link>
and it downloads as normal to the specified folder.
However, when I am calling the process through Java, using ProcessBuilder
as follows:
output = "-o \"" + save_path + "\\%(title)s.%(ext)s\"";
Process process = new ProcessBuilder("lib\\youtube-dl.exe", output, url.getText()).start();
I keep getting the following output:
-o "C:\Users\nightstalker\Videos\youtube-dl\%(title)s.%(ext)s"
Thread Start
[youtube] wnc77S-g0qQ: Downloading webpage
[youtube] wnc77S-g0qQ: Extracting video information
[youtube] wnc77S-g0qQ: Downloading js player en_US-vfljL8ofl
[youtube] wnc77S-g0qQ: Downloading DASH manifest
[download] Destination: C#\Users\nightstalker\Videos\youtube-dl\Some Video.mp4
This is what save_path
looks like
File save_path = new File("C:\\Users\\"+System.getProperty("user.name")+"\\Videos\\youtube-dl");
This basically creates a folder called C#\Users\nightstalker\Videos\youtube-dl
and continues to download there.
Any reason why?