Skip to content

Instantly share code, notes, and snippets.

@meetmangukiya
Created June 4, 2018 07:35
Show Gist options
  • Save meetmangukiya/27d53cd64372c7fdf52958468d08e709 to your computer and use it in GitHub Desktop.
Save meetmangukiya/27d53cd64372c7fdf52958468d08e709 to your computer and use it in GitHub Desktop.
Download youtube videos as mp3 from a given playlist
import sys
import youtube_dl
opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
'outtmpl': '%(title)s.%(ext)s'
}
with youtube_dl.YoutubeDL(opts) as ydl:
ydl.download([sys.argv[-1]])
@meetmangukiya
Copy link
Author

Installing youtube-dl

pip install youtube-dl

Usage

python downloader.py https://www.youtube.com/playlist?list=<list_id>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment