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.
If you are only renaming files because you don't like the style by which youtube-dl
names them, then you can use --output
(or -o
) with a template to customize the way it names all the files from Youtube metadata.
For example, -o %(title)s.%(ext)s
will cause it to leave out the Youtube IDs from all of the filenames.
There are a lot of options, which may depend on your version of youtube-dl
, so full details on this can be found at the terminal by typing:
man youtube-dl
/OUTPUT
However if you do want to name each file individually, you could instead run youtube-dl
once for each line in the text file like this:
(while read URL NAME; do [ "$URL" ] && youtube-dl --format mp4 -o "$NAME" "$URL"; done) < data.txt
For each line, split it at the first run of one or more tabs and spaces into a URL and NAME, then if the line is not blank, pass them to youtube-dl
. If the line just has a URL, the file will not be renamed.
Best Answer
There is a built-in search option for youtube-dl. Old way:
The argument is:
gvsearchX
, wheregvsearch
means use google andX
is the number of results you want to download. So the above will search for "how to create android app in app studio" and download the first result.(Update!) Seems like ytsearch (youtube search) is the better approach now: