Spaces:
Paused
Paused
Update src/main.py
Browse files- src/main.py +3 -10
src/main.py
CHANGED
|
@@ -64,19 +64,12 @@ def yt_download(link):
|
|
| 64 |
ydl_opts = {
|
| 65 |
'format': 'bestaudio/best',
|
| 66 |
'outtmpl': 'ytdl/%(title)s.%(ext)s',
|
| 67 |
-
'postprocessors': [{
|
| 68 |
-
'key': 'FFmpegExtractAudio',
|
| 69 |
-
'preferredcodec': 'wav',
|
| 70 |
-
'preferredquality': '192',
|
| 71 |
-
}],
|
| 72 |
}
|
| 73 |
|
| 74 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 75 |
-
|
| 76 |
-
download_path = ydl.prepare_filename(
|
| 77 |
-
sample_rate, audio_data = read(file_path)
|
| 78 |
-
audio_array = np.asarray(audio_data, dtype=np.int16)
|
| 79 |
-
|
| 80 |
return download_path
|
| 81 |
|
| 82 |
|
|
|
|
| 64 |
ydl_opts = {
|
| 65 |
'format': 'bestaudio/best',
|
| 66 |
'outtmpl': 'ytdl/%(title)s.%(ext)s',
|
| 67 |
+
'postprocessors': [{'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3'}],
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
}
|
| 69 |
|
| 70 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 71 |
+
result = ydl.extract_info(link, download=True)
|
| 72 |
+
download_path = ydl.prepare_filename(result, outtmpl='%(title)s.mp3')
|
|
|
|
|
|
|
|
|
|
| 73 |
return download_path
|
| 74 |
|
| 75 |
|