Downloading YouTube Videos
This guide explains how to download educational videos from YouTube for offline use in the classroom. It uses a command-line tool called yt-dlp, which is managed via asdf.
FIREWALL:
To download from YouTube, you must temporarily stop the firewall. As the admin user, run rsv stop nftables. This is the only step that requires admin privileges. The rest of the process should be run as the guest user.
Installing and Using yt-dlp
1. Add the yt-dlp Plugin
First, you need to add the asdf plugin for yt-dlp.
asdf plugin add yt-dlp2. Install yt-dlp
Now, install the latest version of the tool.
asdf install yt-dlp latest3. Set the Global Version
To make the yt-dlp command available everywhere, set the version you just installed as the global default.
asdf global yt-dlp latest4. Navigate to Download Directory
Change to the directory where you want to save the videos.
# For example, a teacher's public folder
cd /srv/public/teachers/jdoe5. Initiate Download
You can now download a video using its URL or video ID. The -f best flag tells it to download the best available quality.
# Download using the full URL
yt-dlp -f best https://www.youtube.com/watch?v=Qg1ml3aHAM4
# Or download using just the video ID
yt-dlp -f best Qg1ml3aHAM4Tip
You can list all available video and audio formats for a specific URL with the -F flag (e.g., yt-dlp -F <URL>). You can then download a specific format with the -f flag (e.g., yt-dlp -f 22 <URL>).