#!/usr/bin/env python3
import csv
import re

schools = []

with open('schools_waterloo_council.csv', 'r', encoding='utf-8') as f:
    reader = csv.reader(f)
    header = next(reader)  # Skip header
    
    for row in reader:
        if len(row) < 2:
            continue
        
        school_name = row[0].strip() if row[0] else ""
        
        # Find website - look for http or www in any column
        website = ""
        for col in row:
            col = col.strip()
            if col.startswith('http://') or col.startswith('https://') or col.startswith('www.'):
                website = col
                break
        
        # Email is typically in column 2 or 3
        email = ""
        for col in row[2:5]:
            col = col.strip()
            if '@' in col and '.' in col and not col.startswith('http'):
                email = col
                break
        
        if school_name and website:
            schools.append({
                'name': school_name,
                'website': website,
                'email': email
            })

print(f"Found {len(schools)} schools with websites")

# Show first 10
for s in schools[:10]:
    print(f"{s['name']}: {s['website']}")