#!/bin/bash

# Convenience script to run the image scraper
# Usage: ./run_scraper.sh <website_url> [additional_options]

if [ $# -eq 0 ]; then
    echo "❌ Error: Please provide a website URL"
    echo "Usage: ./run_scraper.sh <website_url> [additional_options]"
    echo ""
    echo "Examples:"
    echo "  ./run_scraper.sh https://example.com"
    echo "  ./run_scraper.sh https://example.com -o my_images --delay 2"
    echo "  ./run_scraper.sh https://example.com --max-pages 10 -v"
    exit 1
fi

# Check if virtual environment exists
if [ ! -d "venv" ]; then
    echo "❌ Virtual environment not found. Please run setup.sh first:"
    echo "   chmod +x setup.sh"
    echo "   ./setup.sh"
    exit 1
fi

# Activate virtual environment
echo "🔄 Activating virtual environment..."
source venv/bin/activate

# Run the scraper with all provided arguments
echo "🕸️  Starting image scraper..."
python image_scraper.py "$@"

echo "�� Scraper finished!" 