Here is the important 2 lines of code.
response = urlopen('https://www.youtube.com/results?search_query=' + search)
command = 'youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 ' + video_link
Amazing how useful of a tool you can make with such little code. There is really some great libraries available today.