0
Hello! As said in the title, I’m wanting save the audio I’ll download to a specific folder from my desktop using youtube_dl, but I haven’t found a clear alternative.
The directory I will use in the case is this: C: Users jenka Desktop Work Sources
Does anyone have any solution?
import youtube_dl
import pytube
videoORaudio = input('Deseja baixar em MP3 ou Video? [1] para MP3 e [2] para Vídeo. -> ')
if videoORaudio == '1':
video_url = input("Coloque o link do vídeo abaixo: ")
video_info = youtube_dl.YoutubeDL().extract_info(url=video_url, download=False)
filename = f"{video_info['title']}.mp3"
options = {
'format' : 'bestaudio/best',
'keepvideo': False,
'outtmpl': filename,
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192'
}]
}
with youtube_dl.YoutubeDL(options) as ydl:
ydl.download([video_info['webpage_url']])