How to download playalist except certain videos in youtube-dl?

Solution 1:

You can use the following switch:

 --playlist-items ITEM_SPEC       Playlist video items to download. Specify
                                     indices of the videos in the playlist
                                     separated by commas like: "--playlist-items
                                     1,2,5,8" if you want to download videos
                                     indexed 1, 2, 5, 8 in the playlist. You can
                                     specify range: "--playlist-items
                                     1-3,7,10-13", it will download the videos
                                     at index 1, 2, 3, 7, 10, 11, 12 and 13.

So it would be:

youtube-dl -f 22 --playlist-items 7-X https://www.youtube.com/playlist?list=PLO-hrPk0zuI18xlF_480s6UiaGD7hBqJa

where X is the number of videos in the playlist.

Solution 2:

youtube-dl has an option -i which will do what you asked, skip the deleted/restricted items and download anything in the play list that is available. See the “Options” section of the manual page (man youtube-dl).