Search code examples
linuxbashyoutubeplaylistyoutube-dl

get newest additions to a youtube playlist using youtube-dl


I've got a collaborative youtube playlist with some friends that we use when we get together to play games. The problem is that the internet connection where we get together is quite bad. So I made a little script where people can send songs using bluetooth or by sending a youtube link (youtube-dl downloads the mp3 file of that video using a script that uses the currently selected (youtube) link). I wanted an easier method of adding videos to the offline playlist.

I want to use the collaborative playlist to determine which songs are to be downloaded but I only want the newest additions to the playlist (since the last check/download) is it possible to retrieve the latest youtube playlist items in linux bash?


Solution

  • Have a look at the video selection options. In particular, --download-archive can be used for this purpose.

    Simply run youtube-dl --download-archive /path/to/the/archive/file playlist_url. This will download all new songs in the playlist. If your playlist is large, you can also use --playlist-end 42 to only consider the first 42 songs.