Skip to content

Instantly share code, notes, and snippets.

@Tjorriemorrie
Created November 7, 2017 23:42
Show Gist options
  • Save Tjorriemorrie/a7cc5cddb556fd81745cedef84ab594d to your computer and use it in GitHub Desktop.
Save Tjorriemorrie/a7cc5cddb556fd81745cedef84ab594d to your computer and use it in GitHub Desktop.
convert youtube to mp3
from __future__ import unicode_literals
import youtube_dl
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
videos_list = [
]
videos_urls = ['https://www.youtube.com/watch?v={}'.format(v) for v in videos_list]
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(videos_urls)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment