import requests

API_KEY = "1058i9fguonl5ibz854n"  # replace with your real key
API_URL = "https://abstream.to/api/upload/url"
VIDEO_URL = "https://abstream.to/embed/s5nntho2s6rk"  # replace with the video embed/download URL


# Optional fields:
params = {
    "key": API_KEY,
    "url": VIDEO_URL,
    "file_public": 1,       # 1 = public, 0 = private
    "file_adult": 1,        # 1 = adult, 0 = safe
    "tags": "test, upload"  # optional tagsR
}

response = requests.get(API_URL, params=params)

if response.status_code == 200:
    data = response.json()
    if data["status"] == 200:
        filecode = data["result"]["filecode"]
        print(f"✅ Upload started successfully! File code: {filecode}")
        print(f"Embed page: https://abstream.to/{filecode}.html")
    else:
        print("❌ API error:", data["msg"])
else:
    print("❌ Request failed:", response.status_code, response.text)
    
    
    
