Heretic Webdl |link| [ FREE - 2024 ]

# --------------------------------------------------- # # Simple in‑memory rate limiter (IP → timestamps) # --------------------------------------------------- # _rate_limiter: Dict[str, list[datetime]] = defaultdict(list)

app = FastAPI( title="Heroku Web‑DL", description="A tiny HTTP API that streams any publicly reachable file back to the caller.", version="0.1.0", ) heretic webdl

# ---- logging ----------------------------------------------------------------- LOG_LEVEL = os.getenv("LOG_LEVEL", "info") heretic webdl

# Stream the remote file directly back to the caller # We preserve the original content‑type and disposition when possible async def generator(): async for chunk in stream_remote_file(payload.url): yield chunk heretic webdl

# 3️⃣ Install deps pip install -r requirements.txt

# Guess a filename from the URL if the remote server doesn't set one filename = payload.url.path.split("/")[-1] or "downloaded_file"

headers = "Content-Disposition": f'attachment; filename="filename"', # The downstream `StreamingResponse` will automatically forward # the `Content-Type` from the remote response if we set it later.