can youtube-dl ignore specific videos while downloading a playlist?

I would like to download an entire playlist from Youtube but I would also like it NOT to download specific videos from the playlist. I know the link and the name of those videos in advance and can therefore give that information to youtube-dl

So far the best solution I have is downloading the playlist and then running a shell script that removes the unwanted videos. This is obviously very limited ( the video is downloaded each time I try to download the new videos added to the playlist )

Is it possible to ask youtube-dl to ignore specific videos directly by command line or by file ( that would contain the names or urls of the unwanted videos ) ?

Upvotes: 1

Views: 1741

Answers (2)

Nanashi No Gombe
Nanashi No Gombe

Reputation: 630

Yes, you can do that by passing the following flags.

--playlist-start NUMBER      Playlist video to start at (default is
                             1)
--playlist-end NUMBER        Playlist video to end at (default is
                             last)
--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.

Upvotes: 3

marcin
marcin

Reputation: 101

Yes.

  1. Put list of unwanted clips into file; unwanted.txt (one url per line)
  2. Get all urls from the playlist and save in a file
    youtube-dl -ij --flat-playlist "your_playlist" | jq -r '"https://youtu.be/\(.id)"' > listurl.txt
  1. Challenge thhose files to remove common occurrences
    grep -vf unwanted.txt listurl.txt > download.txt
  1. Download desirable vids witch a batch file
    youtube-dl -ia download.txt

Upvotes: 2

Related Questions