Skip to main content

Purpose

Detects content changes on a website using an efficient 2-stage approach that minimizes Firecrawl costs:
  1. Hashing Service - Fetch raw HTML directly (free) and compare hashes
  2. Batch Scrape - Only scrape pages that actually changed (paid)

Architecture

Detection Logic

  1. Get stored data - Retrieve site_map (URL list) and page_hashes from ai_sites
  2. Map current URLs - Use custom mapper to get current URL list [FREE]
  3. Compare URL lists - Find new URLs, removed URLs, existing URLs
  4. Fetch + Hash existing pages - Use hashing service to get raw HTML and hash [FREE]
  5. Compare hashes - Find which existing pages changed
  6. Batch scrape - Only scrape NEW + CHANGED pages with Firecrawl [PAID]

Cost Optimization

Example: Site with 100 pages, 3 changed
  • Old approach: 100 × 0.01=0.01 = 1.00
  • New approach: 3 × 0.01=0.01 = 0.03

Response Format

Change Categories

Code Location

Used By

  • Daily cron job for site freshness
  • Triggers update-ai-site when changes found
  • Triggers discover-products-from-changes for new pages