To download a Youtube video or playlist, you need to use a Linux distribution and install the application called youtube-dl

Install Youtube-dl application

Install this application in Ubuntu-liked Linux distributions is very simple, just run the Linux command :
sudo apt-get install youtube-dl

However you might run into this following error when you try to download a playlist

WARNING: [youtube:playlist] PL7v9Cnc2zdWBwPWd_UkC0tV0ISIH-BtHA: Playlist page is missing OpenGraph title, falling back ...
ERROR: Unable to extract title; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.

Therefore, it’s best if you can install it manually:

sudo wget https://yt-dl.org/downloads/2014.09.01.2/youtube-dl -O /usr/bin/youtube-dl
sudo chmod a+x /usr/bin/youtube-dl

For other systems, please visit the project website

After installation completes , now you can download a video or a playlist from Youtube.

To download a video, run the following command:
$ youtube-dl youtube-video-link

To download a playlist, run this command:
$ youtube-dl -citk --max-quality FORMAT http://www.youtube.com/playlist?list=Playlist-ID

To download a playlist also extract audio as MP3 audio files, run this command:
$ youtube-dl -citk --max-quality FORMAT --extract-audio --audio-format mp3 http://www.youtube.com/playlist?list=Playlist-ID
youtube-dl -cit --extract-audio --audio-format mp3 https://www.youtube.com/playlist?list=PLID

with Metadata added:

youtube-dl -cit --extract-audio --audio-format mp3 --add-metadata --metadata-from-title "%(artist)s - %(title)s" https://www.youtube.com/playlist?list=PL3oW2tjiIxvQ1BZS58qtot3-p-lD32oWT

To download all of videos in a Youtube Channel or user, run this command:
youtube-dl -citw ytuser:Youtube_User_ID

Download youtube and slit by chapters as audios:

Installing this application: https://github.com/yt-dlp/yt-dlp/

sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp

To download:

 yt-dlp --verbose --split-chapters --ffmpeg-location "/usr/local/bin" --audio-format mp3 --extract-audio --audio-quality 5 -o "./%(section_title)s.%(ext)s" "https://www.youtube.com/watch?v={{ video ID }}" 

 

Enjoy!!!