Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -347,7 +347,7 @@ def download_audio(url, cookie_file=None):
|
|
| 347 |
output_path = 'ytdl/gdrive_audio.wav'
|
| 348 |
audio = AudioSegment.from_file(temp_output_path)
|
| 349 |
audio.export(output_path, format="wav")
|
| 350 |
-
sample_rate, data = wavfile.read(output_path)
|
| 351 |
return output_path, "Download successful", (sample_rate, data)
|
| 352 |
else:
|
| 353 |
os.makedirs('ytdl', exist_ok=True)
|
|
@@ -359,7 +359,7 @@ def download_audio(url, cookie_file=None):
|
|
| 359 |
file_path = file_path.replace(ext, '.wav')
|
| 360 |
if not os.path.exists(file_path):
|
| 361 |
return None, "Downloaded file not found", None
|
| 362 |
-
sample_rate, data = wavfile.read(file_path)
|
| 363 |
return file_path, "Download successful", (sample_rate, data)
|
| 364 |
except yt_dlp.utils.ExtractorError as e:
|
| 365 |
if "Sign in to confirm you’re not a bot" in str(e):
|
|
|
|
| 347 |
output_path = 'ytdl/gdrive_audio.wav'
|
| 348 |
audio = AudioSegment.from_file(temp_output_path)
|
| 349 |
audio.export(output_path, format="wav")
|
| 350 |
+
sample_rate, data = scipy.io.wavfile.read(output_path) # Fixed: Use scipy.io.wavfile.read
|
| 351 |
return output_path, "Download successful", (sample_rate, data)
|
| 352 |
else:
|
| 353 |
os.makedirs('ytdl', exist_ok=True)
|
|
|
|
| 359 |
file_path = file_path.replace(ext, '.wav')
|
| 360 |
if not os.path.exists(file_path):
|
| 361 |
return None, "Downloaded file not found", None
|
| 362 |
+
sample_rate, data = scipy.io.wavfile.read(file_path) # Fixed: Use scipy.io.wavfile.read
|
| 363 |
return file_path, "Download successful", (sample_rate, data)
|
| 364 |
except yt_dlp.utils.ExtractorError as e:
|
| 365 |
if "Sign in to confirm you’re not a bot" in str(e):
|