Skip to content

Instantly share code, notes, and snippets.

@ibrahimokdadov
Created March 25, 2020 07:46
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibrahimokdadov/480ad18d4ca4dad5ba348ab8d803ecaa to your computer and use it in GitHub Desktop.
Save ibrahimokdadov/480ad18d4ca4dad5ba348ab8d803ecaa to your computer and use it in GitHub Desktop.
youtube to mp3
#prerequisites:
#ffmpeg and youtube-dl
#python youtube_mp3.py <youtube_url>
import youtube_dl
import sys
params ={
'format': 'bestaudio/best',
'postprocessors':[{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
youtube= youtube_dl.YoutubeDL(params)
youtube.download(sys.argv[1:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment