# Pytube dosent accept .mp3 format so the better way to do it is doing a
# function with os
from pytube import YouTube, Playlist
import os
yt_url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
def donwload_mp3():
audio = YouTube(yt_url).streams.get_audio_only()
audio_download = audio.download(output_path='your path')
base, ext = os.path.splitext(audio_download)
new_file = base + '.mp3'
os.rename(audio_download, new_file)
import pytube
from pytube import YouTube
print("Give URL:")
url = input()
pytube.YouTube(url).streams.get_highest_resolution().download()