Took help from this thread : download only audio from youtube video using youtube-dl in python script
import youtube_dl #installed youtube_dl file
options = {
    'format':'bestaudio/best',
    'extractaudio':True,            #extracting audio
    'audioformat':'mp3',            #file options and format
    'outtmpl':'%(id)s.%(ext)s',     #name the file the ID of the video
    'noplaylist':True,
    'nocheckcertificate':True,
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',# Used ffmpeg for converting the file to mp3
        'preferredcodec': 'mp3',
        'preferredquality': '192',
    }]
}
with youtube_dl.YoutubeDL(options) as ydl:
    ydl.download(['https://youtu.be/BZP1rYjoBgI']) #final downloading
