Instal libav-tools
sudo apt-get update sudo apt-get install libav-tools
Install youtube-dl
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl sudo chmod a+rx /usr/local/bin/youtube-dl
Download mp3
youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 -o '%(title)s.%(ext)s' https://www.youtube.com/watch?v=ID
–audio-quality 0 means the best quality available
-o ‘%(title)s.%(ext)s’ will remove the ID from the filename
Download the file from a web browser (optional if you don’t have FTP, SFTP, are on a Windows bashless box)
For python bellow the version 3
python -m SimpleHTTPServer
For python 3 or higher
python3 -m http.server
Now just browse to http://your-server-IP:8000 and download the file
i recommend check out youtube mp3 converter