Website Change Monitor Script

import requests
import time
import hashlib

def get_website_content(url):
    response = requests.get(url)
    return response.text

def hash_content(content):
    return hashlib.sha256(content.encode('utf-8')).hexdigest()

def monitor_website(url, check_interval):
    print(f"Monitoring changes to {url} every {check_interval} seconds...")
    initial_content = get_website_content(url)
    initial_hash = hash_content(initial_content)

    while True:
        time.sleep(check_interval)
        current_content = get_website_content(url)
        current_hash = hash_content(current_content)

        if current_hash != initial_hash:
            print(f"Change detected on {url}!")
            initial_hash = current_hash
        else:
            print("No changes detected.")

if __name__ == "__main__":
    target_url = input("Enter a URL to monitor (e.g., http://example.com): ")
    interval = int(input("Enter the check interval in seconds: "))
    monitor_website(target_url, interval)