Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -110,14 +110,13 @@ def get_spotify_token() -> str:
|
|
110 |
raise HTTPException(status_code=500, detail="Internal server error")
|
111 |
|
112 |
async def get_download_url(url):
|
113 |
-
loop = asyncio.get_running_loop()
|
114 |
api_url = "https://chrunos-ytdl2.hf.space/download"
|
115 |
data = {"url": url}
|
116 |
headers = {
|
117 |
"Content-Type": "application/json"
|
118 |
}
|
119 |
try:
|
120 |
-
response = await
|
121 |
if response.status_code == 200:
|
122 |
result = response.json()
|
123 |
return result.get('download_url')
|
|
|
110 |
raise HTTPException(status_code=500, detail="Internal server error")
|
111 |
|
112 |
async def get_download_url(url):
|
|
|
113 |
api_url = "https://chrunos-ytdl2.hf.space/download"
|
114 |
data = {"url": url}
|
115 |
headers = {
|
116 |
"Content-Type": "application/json"
|
117 |
}
|
118 |
try:
|
119 |
+
response = await requests.post(api_url, json=data, headers=headers)
|
120 |
if response.status_code == 200:
|
121 |
result = response.json()
|
122 |
return result.get('download_url')
|