Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -76,18 +76,15 @@ def download_audio(video_url, quality: str = '128', speed: float = None):
|
|
76 |
'format': 'bestaudio/best',
|
77 |
'outtmpl': '%(title)s.%(ext)s',
|
78 |
'quiet': True,
|
79 |
-
'postprocessors': [{
|
80 |
-
'key': 'FFmpegExtractAudio',
|
81 |
-
'preferredcodec': 'mp3', #'opus',
|
82 |
-
'preferredquality': quality,
|
83 |
-
}]
|
84 |
}
|
85 |
|
86 |
if speed:
|
87 |
-
ydl_opts[
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
91 |
|
92 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
93 |
ydl.download([video_url])
|
|
|
76 |
'format': 'bestaudio/best',
|
77 |
'outtmpl': '%(title)s.%(ext)s',
|
78 |
'quiet': True,
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
if speed:
|
82 |
+
ydl_opts["postprocessors"] = [{
|
83 |
+
"key": "FFmpegExtractAudio",
|
84 |
+
"preferredcodec": "mp3",
|
85 |
+
"preferredquality": quality,
|
86 |
+
"addopts": f"-filter:a \"atempo={speed}\"",
|
87 |
+
}]
|
88 |
|
89 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
90 |
ydl.download([video_url])
|