Difference between revisions of "YouTube Download Server"
(→Tips) |
|||
| (6 intermediate revisions by the same user not shown) | |||
| Line 99: | Line 99: | ||
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.) | 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.) | ||
[[YT-DLP Scripting{{!}}More advanced scripting]] | |||
== Tips == | == Tips == | ||
If you see this error: | If you see this error: | ||
<span style="color: rgb(186, 55, 42);" >ERROR:</span> [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 | <span style="color: rgb(186, 55, 42);">ERROR:</span> [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 | ||
Chances are very good that YouTube hates your VPN exit point. | Chances are very good that YouTube hates your VPN exit point. | ||
| Line 112: | Line 114: | ||
---- | ---- | ||
<span style="color: rgb(186, 55, 42);" >ERROR:</span> [youtube] tLrn3A7HxIs: Sign in to confirm your age. This video may be inappropriate for some users. Use --cookies-from-browser or --cookies for the authentication. See | |||
<span style="color: rgb(186, 55, 42);">ERROR:</span> [youtube] tLrn3A7HxIs: Sign in to confirm your age. This video may be inappropriate for some users. 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 | |||
You may be stuck actually going through the cookie transfer process at this point... | You may be stuck actually going through the cookie transfer process at this point... | ||
Latest revision as of 12:10, 29 September 2025
| 13 (trixie) | This includes a lightweight LXC
|
| As always... | |
|---|---|
|
Start with: |
|
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-dlpsudo 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.
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_Spacesudo vi /etc/fstab
StorageServer:/Download_Space /mnt/Download_Space nfs rw,user,exec 0 0
sudo mkdir /mnt/Download_Space/YTDL
NOTE: When using a VPN, you may need to use IP addresses to refer to other machines on your LAN.
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.
also:
sudo apt install mosquitto-clients
Handy for integrating the download server into your IoT infrastructure...
Usage hints
You can either sign into the machine to download videos, or (especially if you've set up for passwordless SSH) just do it from your desktop.
If you're signed in
yt-dlp -P "/mnt/Download_Space/YTDL/" URLofVideoPage
Where:
- /mnt/Download_Space/YTDL/ Can be any location on that server that you have write access to. Leaving off the -P "/mnt/Download_Space/YTDL/" will download to where ever you are...
- URLofVideoPage is simply the URL of the YouTube video (i.e: https://www.youtube.com/watch?v=NkXLP3VtMS8 )
- NOTE: If you grab the URL while watching from a list or in some other circumstances, youtube will often add extraneous stuff to the end. If you see an & in the URL, this is the start of that stuff & should be stripped off before pasting the URL into your command line.
Simple as that, it'll download the video in approximately the best available resolution.
Take a look at yt-dlp --help or visit their instructions online to learn all about possible options.
Remote usage
ssh DLSERVER yt-dlp -P "/mnt/Download_Space/YTDL/" URLofVideoPage
where:
- DLSERVER is the name or IP of your download server.
Just like you've signed into the server except for the ssh DLSERVER part.
Leaving off the -P "/mnt/Download_Space/YTDL/" will download to your home directory on the server...
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.)
Tips
If you see this error:
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
Chances are very good that YouTube hates your VPN exit point.
In my case, they seem to dislike Sweden.
Changing to Ukraine solved the issue... ¯\_(ツ)_/¯
ERROR: [youtube] tLrn3A7HxIs: Sign in to confirm your age. This video may be inappropriate for some users. 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
You may be stuck actually going through the cookie transfer process at this point...
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.