Update app.py
Browse files
app.py
CHANGED
@@ -23,6 +23,9 @@ app.mount("/downloads", StaticFiles(directory="downloads"), name="downloads")
|
|
23 |
# Deezer API base URL
|
24 |
DEEZER_API_URL = "https://api.deezer.com"
|
25 |
|
|
|
|
|
|
|
26 |
# Deezer ARL token (required for deezspot downloads)
|
27 |
ARL_TOKEN = os.getenv('ARL')
|
28 |
dl = DeeLogin(arl=ARL_TOKEN)
|
@@ -97,7 +100,9 @@ def download_track(track_id: str, quality: str = "MP3_320"):
|
|
97 |
|
98 |
# Return the download URL
|
99 |
relative_path = os.path.relpath(mp3_filepath, "downloads")
|
100 |
-
|
|
|
|
|
101 |
logger.info(f"Download successful: {download_url}")
|
102 |
return {"download_url": download_url}
|
103 |
except Exception as e:
|
|
|
23 |
# Deezer API base URL
|
24 |
DEEZER_API_URL = "https://api.deezer.com"
|
25 |
|
26 |
+
# Base URL for the server
|
27 |
+
BASE_URL = "https://tecuts-depot.hf.space"
|
28 |
+
|
29 |
# Deezer ARL token (required for deezspot downloads)
|
30 |
ARL_TOKEN = os.getenv('ARL')
|
31 |
dl = DeeLogin(arl=ARL_TOKEN)
|
|
|
100 |
|
101 |
# Return the download URL
|
102 |
relative_path = os.path.relpath(mp3_filepath, "downloads")
|
103 |
+
# Remove spaces from the relative path
|
104 |
+
relative_path = relative_path.replace(" ", "%20")
|
105 |
+
download_url = f"{BASE_URL}/downloads/{relative_path}"
|
106 |
logger.info(f"Download successful: {download_url}")
|
107 |
return {"download_url": download_url}
|
108 |
except Exception as e:
|