Youtube - downloading a playlist - youtube-dl
I am trying to download all the videos from the playlist:
I am using youtube-dl for this and the command is:
youtube-dl -citk –format mp4 –yes-playlist https://www.youtube.com/watch?v=7Vy8970q0Xc&list=PLwJ2VKmefmxpUJEGB1ff6yUZ5Zd7Gegn2
But this only downloads the first video. Not sure what I am doing wrong.
Solution 1:
In a shell, &
is a special character, advising the shell to start everything up to the & as a process in the background. To avoid this behavior, you can put the URL in quotes. See the youtube-dl FAQ for more information.
Also beware of -citk
. With the exception of -i
, these options make little sense. See the youtube-dl FAQ for more information. Even -f mp4
looks very strange.
So what you want is:
youtube-dl -i -f mp4 --yes-playlist 'https://www.youtube.com/watch?v=7Vy8970q0Xc&list=PLwJ2VKmefmxpUJEGB1ff6yUZ5Zd7Gegn2'
Alternatively, you can just use the playlist ID:
youtube-dl -i PLwJ2VKmefmxpUJEGB1ff6yUZ5Zd7Gegn2
Solution 2:
I found the best solution after many attempts at solving this problem.
Installation and usage;
For Windows users:
Script:
youtube-dl --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 160K --output "%(title)s.%(ext)s" --yes-playlist https://www.youtube.com/playlist?list={your-youtube-playlist-id}
- Download youtube-dl.exe file from the offical site.
- Dowload ffmpeg from the offical site for convert WebM to MP3 (Recomended build version)
- Exctract all zip files and move youtube-dl.exe, ffmpeg.exe and ffprobe.exe files to the folder that where you want the downloaded MP3 files.
- Open cmd (Windows terminal) in same folder.
- Replace the script
{your-youtube-playlist-id}
parameter with your YouTube playlist id. - Run the script.
For macOS/Linux users:
Script:
youtube-dl --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 160K --output "%(title)s.%(ext)s" --yes-playlist 'https://www.youtube.com/playlist?list={your-youtube-playlist-id}'
- Open terminal and if you don't have Homebrew, install it. (Linux users can skip this step.)
- Run
brew install youtube-dl ffmpeg
and install youtube-dl and ffmpeg for convert WebM to MP3. (Installation may take longer to install other dependencies.) (For Linux users:sudo apt-get install youtube-dl ffmpeg
) - Open a terminal in the folder where you want to download the MP3 files.
- Replace the script
{your-youtube-playlist-id}
parameter with your YouTube playlist id. - Run the script.