- Download youtube-dl sudo apt-get install youtube-dl
- Update your system sudo apt-get update
- Check your version youtube-dl --version
- Update to the last version sudo youtube-dl -U
- Download all videos ignoring and retrying on errors and extracting using the best quality of video and audio on mp4 format
i.e. if your youtube's shared link is:
https://www.youtube.com/watch?v=u78iVL-6htc&list=PL05kpwpMmS0aQVNMGn3jSbYYLZzRXI4wF
your command will be:
youtube-dl -citf 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' https://www.youtube.com/playlist?list=PL05kpwpMmS0aQVNMGn3jSbYYLZzRXI4wF
If you only want the mp3 file:
youtube-dl -f bestaudio "https://www.youtube.com/watch?v=[replace with the code after the equal]" --exec "ffmpeg -i {} -codec:a libmp3lame -qscale:a 0 {}.mp3 && rm {} "
Attention: replace & by the correct double ampersand
you must have installed ffmpeg:
Manually installing ffmpeg with libmp3lame encoder support.
- Install lame encoder Download and extract lame from https://sourceforge.net/projects/lame
- To extract use this command: tar xvzf lame-[your version].tar.gz
- access your extracted directory cd lame-*
- Create the Makefile ./configure
- make
- sudo make install
- Clone and install ffmpeg git clone https://git.ffmpeg.org/ffmpeg.git
- Create Makefile using lame MP3 parameters ./configure --enable-libmp3lame
- make
- sudo make install
After all of these steps, you can use the youtube-dl command