How to download a youtube playlist with numbered prefix via youtube-dl?

The best solution I found is:

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

I think using

youtube-dl --auto-number url

will do it.


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

youtube-dl -o "%(playlist_index)2d - %(title)s.%(ext)s"
#                               .
#                              /|\
#                               |

or 3d or 4d and so on, as in C's printf:

  • Using 2d, you get numbers starting from 01
  • Using 3d, you get numbers starting from 001
  • And so on...