102

I have a Youtube playlist, I want to download it but I want youtube-dl to name the files like 1-{name}, 2-{name}, ... n-{name} in order to be able to watch them in the same sequence as original Youtube playlist. In other words I need my downloaded videos to be prefixed with numbers. How can I do that?

5 Answers5

157

The best solution I found is:

youtube-dl -o "%(playlist_index)s-%(title)s.%(ext)s" <playlist_link>
20

I think using

youtube-dl --auto-number url

will do it.

SarpSTA
  • 1,011
19

Use the -o option with playlist_index and the format <n>d like this:

youtube-dl -o "%(playlist_index)02d - %(title)s.%(ext)s" PLaPV8TkYEUV05rhlfVKXKqxvTkQ_3Tqek
#                               .
#                              /|\
#                               |
Nabil Kadimi
  • 2,282
10

Please use the below link to download playlist in numbers in increment at first followed by title of the content

youtube-dl -cio '%(autonumber)s-%(title)s.%(ext)s' 'Paste your playlist link'
Fabby
  • 35,017
3

excellent! but it leaves you with a file called 00001nameoffile
so run:

rename 's/000//g' *

afterwards
to get 01,02,03 etc
For this line below

youtube-dl -cio '%(autonumber)s-%(title)s.%(ext)s' 'Paste your playlist link'

or as one line:

youtube-dl -cio '%(autonumber)s-%(title)s.%(ext)s' url ; rename 's/000//g' *

shantiq
  • 607