Difference between revisions of "DownloadServer - Youtube"

From The TinkerNet Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
BREAKING NEWS: Might be time to switch to [https://github.com/yt-dlp/yt-dlp yt-dlp]
 +
 
There are a few good reasons to be set up to download YouTube videos.
 
There are a few good reasons to be set up to download YouTube videos.
  
Line 38: Line 40:
 
This is often caused by YouTube being weird...
 
This is often caused by YouTube being weird...
  
Adding <code>-f "bestvideo[height<=720]+bestaudio/best"</code> into the command line sometimes fixes it.
+
Adding <code>-f "bestvideo[height<=720]+bestaudio/best" --merge-output-format mp4</code> into the command line sometimes fixes it.
  
 
([https://www.reddit.com/r/youtubedl/comments/s4pd6h/what_is_the_meaning_of_error_did_not_get_any_data/hssg8xs/ Reference])
 
([https://www.reddit.com/r/youtubedl/comments/s4pd6h/what_is_the_meaning_of_error_did_not_get_any_data/hssg8xs/ Reference])
 
Problem then is...  combining it back together instead of having separate audio...
 

Latest revision as of 12:49, 17 April 2023

BREAKING NEWS: Might be time to switch to yt-dlp

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.

But you may need to install python first...

  • sudo apt install python

youtube-dl

youtube-dl is a pretty awesome tool.

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://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
  • sudo chmod a+rx /usr/local/bin/youtube-dl

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

  • sudo youtube-dl -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:

youtube-dl -w --download-archive 11111111-ARCHIVE --write-description -f 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.)

Troubleshooting

ERROR: Did not get any data blocks

This is often caused by YouTube being weird...

Adding -f "bestvideo[height<=720]+bestaudio/best" --merge-output-format mp4 into the command line sometimes fixes it.

(Reference)