fullpwerr's picture
Refactor bypass_shinigami function to remove HTTP request checks and enhance response structure with title and meta headers
2bcf1c8
raw
history blame contribute delete
685 Bytes
from fastapi import FastAPI, Query, HTTPException
from app.utils import bypass_shinigami
app = FastAPI()
@app.get("/")
async def root():
return {"message": "API Aktif"}
@app.get("/bypass")
async def bypass(
url: str = Query(
...,
description="URL Shinigami yang mau dibypass",
example="https://shinigami.link/xxxx"
)
):
url = url.strip()
if not url or not url.startswith("http"):
raise HTTPException(status_code=400, detail="URL tidak valid")
result = bypass_shinigami(url)
if result.get("status") != "success":
raise HTTPException(status_code=502, detail=result.get("message", "Unknown error"))
return result