Skip to content

Downloading YouTube Videos

This guide explains how to download educational videos from YouTube for offline use in the classroom. There are 2 methods available: using a recommended command-line tool or a simple browser add-on.


Downloading videos can significantly impact your school’s network and computer storage. Follow these guidelines:

  • Copyright Guidance: Only download videos that are explicitly permitted for educational use or fall under “Fair Use” policies. Avoid downloading commercial movies or copyrighted music without permission.
  • Storage Caution: High-quality videos (1080p and above) use a lot of disk space. Regularly delete old videos from your public folders to ensure there is enough room for new content.

Section titled “Method 1: Using the Command Line (Recommended)”

This method is recommended for its power and reliability. It uses a command-line tool called yt-dlp.

  1. Install yt-dlp

    First, you need to add the asdf plugin for yt-dlp and install it. This only needs to be done once.

    # Add the plugin
    asdf plugin add yt-dlp
    
    # Install the latest version
    asdf install yt-dlp latest
    
    # Set it as the global default
    asdf set yt-dlp latest
    
    # Export the asdf shims to your PATH for the current session
    export PATH="/srv/guest/asdf/shims:$PATH"
  2. Navigate to Download Directory

    Change to the directory where you want to save the videos. By default, downloads are saved to the current folder you are in.

    # Save to a teacher's public folder so others can access them
    cd /srv/public/teachers/jdoe
  3. Download the Video(s)

    You can now download a video using its URL. The -f best flag tells the tool to download the best available merged video and audio quality.

    Single Video:

    yt-dlp -f best https://www.youtube.com/watch?v=Qg1ml3aHAM4

    Batch Download (Multiple URLs): You can download multiple videos at once by listing the URLs separated by spaces, or by pointing to a text file containing one URL per line.

    # Using multiple URLs
    yt-dlp -f best URL1 URL2 URL3
    
    # Using a text file (e.g., videos.txt)
    yt-dlp -f best -a videos.txt
  4. Restart the Firewall

    Important: Once you have finished downloading your videos, you MUST restart the firewall to ensure the computer remains protected.

    # As the admin user
    rsv start nftables

Method 2: Using a Firefox Add-on (Alternative)

Section titled “Method 2: Using a Firefox Add-on (Alternative)”

This is an alternative method for users who prefer a graphical interface. It involves temporarily adding a video downloader tool to the Firefox web browser.

Firefox add-on steps
  1. Open Firefox Add-ons

    • Open the Firefox browser.
    • Click the menu button (☰) in the top-right corner and select Add-ons and themes.
    • Alternatively, you can press Ctrl + Shift + A.
  2. Find a Downloader Add-on

    • In the “Find more add-ons” search box, type youtube downloader and press Enter.
    • Browse the search results and choose an add-on that looks suitable. Read the descriptions and reviews to help you decide.
  3. Add the Add-on to Firefox

    • Once you’ve chosen an add-on, click on it, and then click the Add to Firefox button.
    • A permission pop-up will appear. Click Add to confirm.
  4. Download the Video

    • Navigate to the YouTube video you want to download.
    • The add-on will typically add a “Download” button near the video player. Click it and follow the on-screen instructions to save the video file to the computer.

If your download fails, check the following:

  • Firewall: Did you run rsv stop nftables as the admin user? yt-dlp cannot connect to YouTube if the firewall is active.
  • Disk Space: Check if the computer has enough space. You can run df -h /srv/public to see available space in the public folder.
  • Private/Deleted Videos: Ensure the video is public and hasn’t been removed by YouTube.
  • Update the Tool: YouTube often changes how they deliver videos. If downloads consistently fail, you may need to update yt-dlp by running asdf install yt-dlp latest again.