Reputation: 842
Im using python subprocess.call()
to call [youtube-dl.exe][1]
and passing parameters like so
downloadLocation = "-o " + "C:/Users/username/Documents/Youtube/%(title)s.%(ext)s"
subprocess.call(["youtube-dl",
"-f" "bestvideo[ext=mp4, height=1080]+bestaudio[ext=m4a]/best[ext=mp4, height=1080]/best",
downloadLocation,
url])
But the result is(on python console): [download] Destination: C#\Users\username\Documents\Youtube\myVideoFile.mp4
And the files are getting downloaded in the current directory from where the python call is made.
Example: "C:\Users\username\PycharmProjects\pytest\ C#\Users\username\Documents\Youtube"
It looks like to me it's unable to escape the ":" character in the file path.
Please help
Upvotes: 0
Views: 908
Reputation: 842
Update: Here's how i got it to work
subprocess.call(["youtube-dl",
"-f" "bestvideo[ext=mp4, height=1080]+bestaudio[ext=m4a]/best[ext=mp4, height=1080]/best",
"-o" "%s" %downloadLocation,
"--ignore-errors",
url])
Upvotes: 1