Spaces:
Running
Running
gimhan commited on
Update main.py
Browse files
main.py
CHANGED
|
@@ -4,6 +4,7 @@ import subprocess
|
|
| 4 |
from fastapi import FastAPI, BackgroundTasks, HTTPException
|
| 5 |
from fastapi.responses import FileResponse
|
| 6 |
import yt_dlp
|
|
|
|
| 7 |
|
| 8 |
app = FastAPI()
|
| 9 |
COOKIES_FILE = "cookies.txt"
|
|
@@ -57,4 +58,17 @@ async def download_song(url: str, background_tasks: BackgroundTasks):
|
|
| 57 |
|
| 58 |
except Exception as e:
|
| 59 |
# මෙතනින් තමයි ඇත්තම ලෙඩේ එළියට එවන්නේ
|
| 60 |
-
return {"error": str(e)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
from fastapi import FastAPI, BackgroundTasks, HTTPException
|
| 5 |
from fastapi.responses import FileResponse
|
| 6 |
import yt_dlp
|
| 7 |
+
import socket
|
| 8 |
|
| 9 |
app = FastAPI()
|
| 10 |
COOKIES_FILE = "cookies.txt"
|
|
|
|
| 58 |
|
| 59 |
except Exception as e:
|
| 60 |
# මෙතනින් තමයි ඇත්තම ලෙඩේ එළියට එවන්නේ
|
| 61 |
+
return {"error": str(e)}
|
| 62 |
+
|
| 63 |
+
import socket
|
| 64 |
+
|
| 65 |
+
@app.get("/debug")
|
| 66 |
+
def debug_network():
|
| 67 |
+
try:
|
| 68 |
+
# YouTube resolve වෙනවද කියලා බලනවා
|
| 69 |
+
host = "www.youtube.com"
|
| 70 |
+
ip = socket.gethostbyname(host)
|
| 71 |
+
return {"status": "Success", "host": host, "ip": ip}
|
| 72 |
+
except Exception as e:
|
| 73 |
+
return {"status": "Failed", "error": str(e)}
|
| 74 |
+
|