youtube mp3 downloader python api code example
Example: python youtube to mp3
# pip install youtube_dl
from youtube_dl import YoutubeDL
from youtube_dl import YoutubeDL
# change the format to bestaudio to get mp3 file.
audio_downloder = YoutubeDL({'format':'bestaudio'})
#This the link for my favorite song (you can put the link to your video).
link_to_youtube_video = 'https://www.youtube.com/watch?v=ZQ2nCGawrSY'
#download the audio
audio_downloder.extract_info(link_to_youtube_video)