passing file path to youtube-dl in python
<p>Im using python <code>subprocess.call()</code> to call <code>[youtube-dl.exe][1]</code> and passing parameters like so</p>

<pre><code>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])
</code></pre>

<p>But the result is(on python console): <code>[download] Destination:  C#\Users\username\Documents\Youtube\myVideoFile.mp4</code></p>

<p>And the files are getting downloaded in the current directory from where the python call is made.</p>

<p>Example: <code>"C:\Users\username\PycharmProjects\pytest\ C#\Users\username\Documents\Youtube"</code></p>

<p>It looks like to me it's unable to escape the ":" character in the file path.</p>

<p>Please help </p>

<p><strong>Update:</strong> Here's how i got it to work</p>

<pre><code>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])
</code></pre>

python python-3.x github subprocess youtube-dl