How to download playlist to mp3 format with youtube-dl?

406,102

Solution 1

Both parts of this question (downloading in mp3 and downloading a playlist) are supported by youtube-dl:

youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" <url to playlist>

Some notes from me and the comments:

  • Older versions of youtube-dl struggle with modern playlists. You might need to replace the repo version with the latest.

  • cmo: You can ignore missing ("unavailable in your country", or removed) videos with an -i flag.

  • frans: If your playlist isn't working and the URL contains a v=<ID> element, remove it so there's just the ?list=... item in the querystring.

Solution 2

Note:- Old version of youtube-dl is not able to download play-list. first you know what is your youtube-dl version. To check version of Youtube-dl use command

youtube-dl --version

version 2014.02.17 and older version not able to download play-list. If you use older version then update it by

sudo youtube-dl -U

after successful update use command

youtube-dl -cit https://www.youtube.com/playlist?list=PLttJ4RON7sleuL8wDpxbKHbSJ7BH4vvCk

Also you can create URL list in a simple text file and use following command.

 youtube-dl -cit -a file_name_in_which_you_paste_URL_list

For MP3 format Audio can saved. But audio saves as .m4a format on my machine.

youtube-dl -cit --extract-audio --audio-format mp3 https://www.youtube.com/playlist?list=PLttJ4RON7sleuL8wDpxbKHbSJ7BH4vvCk

NOTE :- If you install youtube-dl from Ubuntu software center. You can't update it from terminal.
Go Software center and update from it.
I test this commands on Wine because my youtube-dl also old. And I am unable to Update it.
If you can update your youtube-dl you can download play-list by using above commands.
I hope it helps...Youtube-dl on WINE

Solution 3

There are a lot of instructions you can find using your favorite search engine. E.g.:

For this Playlist it would be: youtube-dl -t https://www.youtube.com/playlist?list=PLYH8WvNV1YEnNVnJb5ZXxDCE2HDAVVo4M

I hope I could help you!

Solution 4

If you installed using pip, run the following to update:

 sudo pip install youtube-dl --upgrade

Enjoy...

Solution 5

an additon to Oli 's answer. If you have the playlist (in separate lines) with all URLs in it in a text file to download:

youtube-dl --extract-audio --audio-format mp3 --batch-file="/full/path/to/playlist"
Share:
406,102

Related videos on Youtube

user267628
Author by

user267628

Updated on September 18, 2022

Comments

  • user267628
    user267628 over 1 year

    I'm trying to download some videos in mp3 format. It's a playlist. How do I download the whole playlist using one command?

    • Paul Rougieux
      Paul Rougieux about 4 years
      To get the URL for a mix, right click on a song in the mix in the right column. "Copy link location" will give a url ending with &index=7. This is the kind of link which will cause [youtube:playlist] Downloading playlist ....
  • IndexOutOfBoundsException
    IndexOutOfBoundsException over 9 years
    And you should add the parameters by @Oli, too. youtube-dl -t --extract-audio --audio-format mp3 https://www.youtube.com/playlist?list=PLYH8WvNV1YEnNVnJb5ZXx‌​DCE2HDAVVo4M
  • user267628
    user267628 over 9 years
    nope it only downloaded the first video
  • Oli
    Oli over 9 years
    @user267628 I've tested this with a playlist URL and it works for me. I had to upgrade youtube-dl (see link at the end) but it sounds like your problem is you're not giving it a playlist URL.
  • user267628
    user267628 over 9 years
    nope only one song loads
  • tshepang
    tshepang about 9 years
    works for me (version 2015.02.28)
  • Madhav Nikam
    Madhav Nikam almost 9 years
  • Madhav Nikam
    Madhav Nikam almost 9 years
  • penta
    penta over 8 years
    it works perfectly for me
  • Stephen Angelico
    Stephen Angelico over 8 years
    Don't use the Windows version in Wine, just install it with PIP (the Python package manager). You may need to install PIP (sudo apt install pip3), but then sudo pip3 install youtube-dl to install, and sudo pip3 install youtube-dl --upgrade to get the latest version. I recommend upgrading every time before you use youtube-dl. Oh, and yes, use the Python 3 PIP instead of Python 2.
  • frans
    frans over 8 years
    Sometimes you copy s.th. like https://www.youtube.com/watch?v=<VIDEO_ID>&list=<LIST_ID>. I had to remove the v=<ID> part from the URL.
  • Wilf
    Wilf almost 8 years
    Easier to just get the script (using curl and chmod as suggested here) than use a package manager (pip, apt etc)
  • Stígandr
    Stígandr over 7 years
    Wilf, you get the latest version too, which you need to build sometimes depending on distro. but chmod +x yes
  • Stígandr
    Stígandr over 7 years
    Sometimes you need the updated source, just git it and compile it.
  • Stígandr
    Stígandr over 7 years
    Damn just noticed this command only downloads the 51st songs in a playlist due to well youtube.... just so you are aware, must make some workaround of sorts here
  • cmo
    cmo about 7 years
    works perfectly, after updating youtube-dl (i.e. after executing youtube-dl -U). very elegant answer
  • cmo
    cmo about 7 years
    I recommend you include the -i argument in the command. it will skip any videos in the playlist that have been removed from youtube
  • undersound
    undersound almost 7 years
    @cmo thanks for this tip. Works also to skip blocked content based on country.
  • Jack
    Jack almost 7 years
    Thanks for that! @frans thanks you too the tip! Worked fine after removing the v=ID part from the URL :)
  • ssi-anik
    ssi-anik over 5 years
  • Paul Rougieux
    Paul Rougieux about 4 years
    Thanks for this suggestion. What does the 251 stand for? Is this a particular format?
  • Goddard
    Goddard about 4 years
    It is the format type you want to use. You don't have to use the cryptic numbers. If you just want the best and do not care about the format then you can use nothing. It will automatically download the best format it can get, but if you specifically want audio you can target a certain type. github.com/ytdl-org/youtube-dl/blob/master/…
  • Paul Rougieux
    Paul Rougieux about 4 years
    Thanks, that link says "youtube-dl uses -f bestvideo+bestaudio/best as the default format selection ", I guess it makes sens to use -f 'worstvideo,bestaudio' to download sound files.
  • cfx
    cfx over 2 years
    I wanted the padded track numbers as a prefix so I changed this to youtube-dl --extract-audio --audio-format mp3 -o "%(autonumber)02d-%(title)s.%(ext)s" <url to playlist> (added %(autonumber)02d-)