Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,17 +18,18 @@ class MusicDownloader:
|
|
18 |
def download(self, url: str, download_id: str) -> bool:
|
19 |
downloads[download_id] = {'status': 'downloading', 'progress': '0%'}
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
32 |
|
33 |
try:
|
34 |
with YoutubeDL(ydl_opts) as ydl:
|
|
|
18 |
def download(self, url: str, download_id: str) -> bool:
|
19 |
downloads[download_id] = {'status': 'downloading', 'progress': '0%'}
|
20 |
|
21 |
+
ydl_opts = {
|
22 |
+
'format': 'bestaudio/best',
|
23 |
+
'postprocessors': [{
|
24 |
+
'key': 'FFmpegExtractAudio',
|
25 |
+
'preferredcodec': 'mp3',
|
26 |
+
'preferredquality': '192',
|
27 |
+
}],
|
28 |
+
'outtmpl': str(self.download_dir / '%(title)s.%(ext)s'),
|
29 |
+
'writethumbnail': True,
|
30 |
+
'cookiefile': 'cookies.txt', # Path to your cookies file
|
31 |
+
'progress_hooks': [lambda d: self._progress_hook(d, download_id)],
|
32 |
+
}
|
33 |
|
34 |
try:
|
35 |
with YoutubeDL(ydl_opts) as ydl:
|