Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -392,14 +392,15 @@ class VideoProcessor:
|
|
392 |
def __init__(self):
|
393 |
self.supported_formats = ['.mp4', '.avi', '.mov', '.mkv']
|
394 |
self.ydl_opts = {
|
395 |
-
'cookiesfrombrowser': ('chromium',),
|
396 |
'format': 'bestaudio/best',
|
397 |
'postprocessors': [{
|
398 |
'key': 'FFmpegExtractAudio',
|
399 |
'preferredcodec': 'mp3',
|
400 |
'preferredquality': '192',
|
401 |
}],
|
402 |
-
'outtmpl': 'temp_audio
|
|
|
403 |
}
|
404 |
|
405 |
def extract_video_id(self, url: str) -> str:
|
@@ -441,7 +442,7 @@ class VideoProcessor:
|
|
441 |
'preferredcodec': 'mp3',
|
442 |
'preferredquality': '192',
|
443 |
}],
|
444 |
-
'outtmpl':
|
445 |
'cookiefile': cookie_file_path # Utilisation du fichier de cookies
|
446 |
}
|
447 |
|
@@ -450,7 +451,7 @@ class VideoProcessor:
|
|
450 |
ydl.download([url])
|
451 |
|
452 |
# Retourner le chemin du fichier téléchargé
|
453 |
-
return
|
454 |
except Exception as e:
|
455 |
raise RuntimeError(f"Erreur lors du téléchargement : {str(e)}")
|
456 |
|
|
|
392 |
def __init__(self):
|
393 |
self.supported_formats = ['.mp4', '.avi', '.mov', '.mkv']
|
394 |
self.ydl_opts = {
|
395 |
+
#'cookiesfrombrowser': ('chromium',),
|
396 |
'format': 'bestaudio/best',
|
397 |
'postprocessors': [{
|
398 |
'key': 'FFmpegExtractAudio',
|
399 |
'preferredcodec': 'mp3',
|
400 |
'preferredquality': '192',
|
401 |
}],
|
402 |
+
'outtmpl': 'temp_audio.mp3',
|
403 |
+
'cookiefile': 'cookies.txt',
|
404 |
}
|
405 |
|
406 |
def extract_video_id(self, url: str) -> str:
|
|
|
442 |
'preferredcodec': 'mp3',
|
443 |
'preferredquality': '192',
|
444 |
}],
|
445 |
+
'outtmpl': audio_file_path, # Fichier de sortie
|
446 |
'cookiefile': cookie_file_path # Utilisation du fichier de cookies
|
447 |
}
|
448 |
|
|
|
451 |
ydl.download([url])
|
452 |
|
453 |
# Retourner le chemin du fichier téléchargé
|
454 |
+
return audio_file_path
|
455 |
except Exception as e:
|
456 |
raise RuntimeError(f"Erreur lors du téléchargement : {str(e)}")
|
457 |
|