import youtube_dl
import moviepy.editor
print('ссылку:')
i = input('')
ydl_opts = {'outtmpl': "%()s.%(ext)s"}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([i])
video = moviepy.editor.VideoFileClip('.mp4')
audio = video.audio
audio.write_audiofile('.mp3')