Here is my code :
call(['youtube-dl', '-i', '--extract-audio', '--audio-format mp3','-w','ytsearch:'+song ,'-o '+song2file(song)+'.%(ext)s'], shell=False)
Note:This is an implementation of this code : youtuble-dl -i --extract-audio --audio-format mp3 -w ytsearch:Wham Bam -o WhamBam.%(ext)s
Where song = Wham Bam, When I run this cmd it works perfectly but the python implementation is not working.
On running it, it returns me this error:
youtube-dl: error: no such option: --audio-format
Essentially the issue is coming from the fact that you're lumping arguments together in a list entry when they should be separate entries in the list for subprocess to handle them correctly.
In this example it would be something like this:
Notice that
--audio-format
andmp3
are separated