Ubuntu – How to download newly uploaded videos from a youtube channel

command linedownloadswgetyoutubeyoutube-dl

I want to set up a script that uses wget to download a video from a channel on youtube, they upload everyday so I want wget to download the newly uploaded video without me having to go on youtube to get the video's URL. How could I achieve this? If wget can't do it, is there any other command line software that can?

Best Answer

There's already a script for that: youtube-dl can download videos from youtube.com or other video platforms.


The program is provided via the repositories and can be installed from there, however as youtube often change things and the program gets ongoing updates in this special case I recommend installing the latest version from github with these commands instead:

sudo apt remove youtube-dl # uninstall the repo version
sudo wget https://yt-dl.org/latest/youtube-dl -O /usr/local/bin/youtube-dl # download
sudo chmod a+x /usr/local/bin/youtube-dl # make it executable
hash -r # hash

If you installed the program this way you're able to update it using:

sudo youtube-dl -U


Here are some video selection options that could be useful for you:

--playlist-start NUMBER
          Playlist video to start at (default is 1)
--playlist-end NUMBER
          Playlist video to end at (default is last)
--date DATE
          Download only videos uploaded in this date
--dateafter DATE
          Download only videos uploaded on or after this date (i.e.  inclusive)


Download today's videos including resume of partially downloaded files:

youtube-dl --date now -- 'PLFs4vir_WsTyXrrpFstD64Qj95vpy-yo1'

for www.youtube.com/watch?list=PLFs4vir_WsTyXrrpFstD64Qj95vpy-yo1, while the full link also works

Download all videos from the last seven days using the URL list in file:

youtube-dl --dateafter now-7days -a file

Download all videos from the last month using the URL list in file, but don't touch any already downloaded videos located in the directory:

youtube-dl --dateafter now-1month -a file -w

See man youtube-dl for much more.