Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -69,9 +69,14 @@ def download_audio_from_youtube(youtube_url, output_path="downloaded_audio.mp3")
|
|
69 |
}
|
70 |
|
71 |
try:
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
75 |
return output_path
|
76 |
except Exception as e:
|
77 |
return f"Error downloading audio: {e}"
|
|
|
69 |
}
|
70 |
|
71 |
try:
|
72 |
+
command = [
|
73 |
+
"yt-dlp",
|
74 |
+
"-x", # extract audio only
|
75 |
+
"--audio-format", "mp3", # specify mp3 format
|
76 |
+
"-o", output_path, # specify output path
|
77 |
+
youtube_url # YouTube URL
|
78 |
+
]
|
79 |
+
subprocess.run(command, check=True, capture_output=True)
|
80 |
return output_path
|
81 |
except Exception as e:
|
82 |
return f"Error downloading audio: {e}"
|