import requests
import time

# URL del sito web da catturare
url_to_capture = "https://dcvip.one/loc.php"

# Chiave API di Screenshot Machine (sostituisci con la tua chiave)
api_key = "74844a"

try:
    # Chiamata all'API di Screenshot Machine
    api_url = f"https://api.screenshotmachine.com/?key={api_key}&url={url_to_capture}&dimension=1024x768"
    response = requests.get(api_url)

    # Salvataggio dello screenshot con il nome del file "locandina.png"
    file_name = "locandina.png"
    with open(file_name, "wb") as file:
        file.write(response.content)

    print(f"Screenshot catturato e salvato come {file_name}")

except Exception as e:
    print(f"Errore durante la cattura dello screenshot: {e}")
