Update app.py
Browse files
app.py
CHANGED
@@ -10,13 +10,13 @@ def get_audio(url):
|
|
10 |
try:
|
11 |
ydl_opts = {
|
12 |
'format': 'bestaudio/best',
|
13 |
-
'outtmpl': '%(id)s.%(ext)s',
|
14 |
'noplaylist': True,
|
15 |
'quiet': True
|
16 |
}
|
17 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
18 |
info = ydl.extract_info(url, download=True)
|
19 |
-
|
|
|
20 |
return audio_file
|
21 |
except Exception as e:
|
22 |
raise gr.Error(f"Exception: {e}")
|
|
|
10 |
try:
|
11 |
ydl_opts = {
|
12 |
'format': 'bestaudio/best',
|
|
|
13 |
'noplaylist': True,
|
14 |
'quiet': True
|
15 |
}
|
16 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
17 |
info = ydl.extract_info(url, download=True)
|
18 |
+
# Get the output filename from the 'filepath' key of the info dictionary
|
19 |
+
audio_file = info['filepath']
|
20 |
return audio_file
|
21 |
except Exception as e:
|
22 |
raise gr.Error(f"Exception: {e}")
|