December 27, 2019

GUIDE: Download YouTube Videos & Full Playlists

Use Linux (youtube-dl) to download and store YouTube videos / full playlists.

Disclaimer: It is illegal to distribute content from YouTube.

Download YouTube videos and full playlists using any Linux distribution, forcing quality over bandwidth and disk space. Proceed to stream to a device. Learn tips and tricks along the way. Questions and feedback - appreciated.

Find the full list of supported sites here - the list is endless.

If you're unfamiliar here's more information on youtube-dl

Over to the terminal

sudo apt-get update && apt-get upgrade -y && apt-get install -y python 
Keep the system fresh, install python
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
Install youtube-dl

Installation complete. Great work - demonstration time

youtube-dl LINK
Replacing 'LINK' with your YouTube URL.

Have you encountered this?

"ERROR: Unable to download webpage: HTTP Error 429"

Force connections through IPv4:

youtube-dl -4 LINK
Replacing 'LINK' with your URL
Download playlists with sensible outputs. Opt to download best quality file format available. Best practice to create a separate directory. Output template guidance

Install a converter, such as FFmpeg or avconv

sudo apt -y install ffmpeg && cd ~ && mkdir YT && cd YT
Choose 'ffmpeg' or avconv. Change directory 'YT'

Download a full playlist

youtube-dl -o '%(playlist_index)s_%(title)s.%(ext)s' -i -f '(bestvideo+bestaudio/best)[protocol^=http]' --yes-playlist -4 'Playlist Link'
Protocol can be changed to 'https'. Replace 'Playlist Link' with your URL - leaving ' ' in.

Important pointers
- The link needs to contain "&list="
- Good practice to ensure link contains  "&index=1" to start at Track 1
- Force file formats | MP4: -f mp4 | M4A : -f mp3 | WEBM: -f webm - however if these are unavailable, the track may be skipped.

Be sure to grep the README on how to bypass geographic restrictions and different configurations

Tags
Guide | Insight | Life | Linux | Tor