YouTube Download Server

From Da Nerd Mage Wiki
Revision as of 14:23, 18 September 2025 by Tinker (talk | contribs) (→‎Useful things)
Jump to navigation Jump to search
Proven on:
Logo Debian.png
13 (trixie) This includes a lightweight LXC


As always...

Start with:

  • sudo apt update
  • sudo apt upgrade

There are a few good reasons to be set up to download YouTube videos.

  • Geofencing
  • Reliability
  • Bandwidth Management

Fortunately, it's pretty easy to do.

yt-dlp (formerly youtube-dl)

yt-dlp is a pretty awesome tool.

As an added bonus, it also works with a fairly large number of other video sharing sites...

Note: You'll need ffmpeg...

  • sudo apt install ffmpeg

But don't install it through the package manager. It gets incredibly regular updates & the package manager kinda borks this.

Instead, install it directly:

  • sudo wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux -O /usr/local/bin/yt-dlp
  • sudo chmod a+rx /usr/local/bin/yt-dlp

This allows you to regularly update (maybe even through cron) it with the command:

  • sudo yt-dlp -U

Which guarantees you keep up with the multitude of random changes made at YouTube.

Scripting

Example of a useful script to update a local copy of a YouTube Channel:

yt-dlp -w --download-archive 11111111-ARCHIVE --write-description -t mp4 -o "%(upload_date)s - %(title)s.%(ext)s" https://www.youtube.com/user/LastWeekTonight

This particular little script maintains a local archive of a channel that YouTube thinks Canadians should not be allowed to watch... (needless to say, it gets run on the VPN equipped Download Server.)

Storage

Storage space for downloading (Torrents & such) should be done on a dedicated drive.

I tend to do most of my storage via NFS served up by my dedicated storage server.

Create a DONE & a WIP folder on the storage drive. This will make it easier to keep things organised.

  • sudo mkdir /mnt/Download_Space
  • sudo vi /etc/fstab
StorageServer:/Download_Space /mnt/Download_Space nfs rw,user,exec 0 0
  • sudo mkdir /mnt/Download_Space/YTDL

If you don't want to use an NFS share for this, you could either add a dedicated drive or just set up the folders on the boot drive. I'd seriously recommend, at minimum, 500GB of available space.

Useful things

Configure your download server to use a good VPN.

  • sudo apt install mosquitto-clients
    • Handy for integrating the download server into your IoT infrastructure...

Tips

ERROR: [youtube] My7MhdGjLzo: Sign in to confirm you’re not a bot. Use --cookies-from-browser or --cookies for the authentication. See https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp for how to manually pass cookies. Also see https://github.com/yt-dlp/yt-dlp/wiki/Extractors#exporting-youtube-cookies for tips on effectively exporting YouTube cookies

Also... Sidequest... Desktop YT downloading

YoutubeDownloader (Desktop downloader)

Quite functional as long as you don't mind a purely GUI application that can't remember where you really want it to put the files.

Doesn't seem to have any sort of installer...

Just hunt through the folder for the actual application in yer file explorer & double-click it.

It works & isn't particularly hard to use...
For a GUI app, the UI is incrediply limited, but functional enough to get the job done.