Spaces:
Sleeping
Sleeping
Update utils/audio_processing.py
Browse files
utils/audio_processing.py
CHANGED
@@ -25,6 +25,14 @@ def download_audio_as_wav(url, max_filesize_mb=70):
|
|
25 |
max_bytes = max_filesize_mb * 1024 * 1024
|
26 |
output_template = os.path.join(temp_dir, "audio.%(ext)s")
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
# yt-dlp download command
|
29 |
download_cmd = [
|
30 |
"yt-dlp",
|
@@ -34,6 +42,7 @@ def download_audio_as_wav(url, max_filesize_mb=70):
|
|
34 |
"--no-playlist",
|
35 |
"--no-cache-dir",
|
36 |
"--restrict-filenames",
|
|
|
37 |
"-o", output_template,
|
38 |
url
|
39 |
]
|
|
|
25 |
max_bytes = max_filesize_mb * 1024 * 1024
|
26 |
output_template = os.path.join(temp_dir, "audio.%(ext)s")
|
27 |
|
28 |
+
cookies_b64 = os.getenv("COOKIES_B64")
|
29 |
+
if not cookies_b64:
|
30 |
+
raise EnvironmentError("COOKIES_B64 environment variable not set.")
|
31 |
+
|
32 |
+
# Decode and write cookies.txt
|
33 |
+
with open(temp_cookie_path, "wb") as f:
|
34 |
+
f.write(base64.b64decode(cookies_b64))
|
35 |
+
|
36 |
# yt-dlp download command
|
37 |
download_cmd = [
|
38 |
"yt-dlp",
|
|
|
42 |
"--no-playlist",
|
43 |
"--no-cache-dir",
|
44 |
"--restrict-filenames",
|
45 |
+
"--cookies", temp_cookie_path,
|
46 |
"-o", output_template,
|
47 |
url
|
48 |
]
|