Prompt

How do I set up a web scraping tool for tracking pricing changes across merchants?

Media & Publishing / Review & Comparison Sites3 observationsLast seen Oct 19, 2026

Latest observation

Oct 19, 2026OpenAI APIWeb search: off

To set up a web scraping tool for tracking pricing changes across merchants, it helps to build it as a small pipeline:

  1. Define the target data
  2. Collect product pages
  3. Extract product names/prices
  4. Store snapshots over time
  5. Compare changes and alert

Here’s a practical approach.


1) Check legal and technical constraints first

Before scraping any merchant site:

  • Review the site’s Terms of Service
  • Check robots.txt
  • Avoid scraping pages that require bypassing logins, CAPTCHAs, or anti-bot protections
  • Use polite request rates and identify your crawler with a user agent
  • Prefer official APIs or affiliate/product feeds when available

If you’re monitoring merchants at scale, this matters a lot for reliability and compliance.


2) Decide what you need to track

For each merchant/product, define:

  • Product name
  • Price
  • Currency
  • Availability
  • SKU / product ID
  • URL
  • Timestamp of capture

Example data model:

{
  "merchant": "Example Store",
  "product_name": "Wireless Mouse",
  "price": 19.99,
  "currency": "USD",
  "availability": "in_stock",
  "url": "https://example.com/product/123",
  "captured_at": "2026-10-19T12:00:00Z"
}

3) Choose a scraping stack

A common stack:

  • Python
  • Requests + BeautifulSoup for simple static pages
  • Playwright or Selenium for JavaScript-rendered pages
  • SQLite/PostgreSQL for storage
  • Cron / GitHub Actions / Airflow for scheduling
  • Email/Slack/webhook alerts for notifications

If you’re just starting, Python + Requests + BeautifulSoup is easiest.


4) Build the scraper

For static pages

Install dependencies:

pip install requests beautifulsoup4 lxml

Example scraper:

import requests
from bs4 import BeautifulSoup

def scrape_product(url):
    headers = {
        "User-Agent": "PriceMonitorBot/1.0 (+contact@example.com)"
    }
    r = requests.get(url, headers=headers, timeout=20)
    r.raise_for_status()

    soup = BeautifulSoup(r.text, "lxml")

    name = soup.select_one(".product-title").get_text(strip=True)
    price_text = soup.select_one(".price").get_text(strip=True)

    # Example parsing, adapt to site format
    price = float(price_text.replace("$", "").replace(",", ""))

    return {
        "url": url,
        "product_name": name,
        "price": price
    }

For dynamic pages

If price loads via JavaScript, use Playwright:

pip install playwright
playwright install

Example:

from playwright.sync_api import sync_playwright

def scrape_dynamic_product(url):
    with sync_playwright() as p:
        browser = p.chromium.launch(headless=True)
        page = browser.new_page()
        page.goto(url, wait_until="networkidle")
        
        name = page.locator(".product-title").inner_text()
        price_text = page.locator(".price").inner_text()
        price = float(price_text.replace("$", "").replace(",", ""))

        browser.close()
        return {
            "url": url,
            "product_name": name,
            "price": price
        }

5) Store data in a database

Use a database to save each scrape as a time-stamped record.

Example SQLite schema:

CREATE TABLE price_snapshots (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    merchant TEXT NOT NULL,
    product_name TEXT NOT NULL,
    price REAL NOT NULL,
    currency TEXT NOT NULL,
    url TEXT NOT NULL,
    captured_at TEXT NOT NULL
);

Then insert each scrape result as a new snapshot.

Why snapshots? Because price changes are detected by comparing current vs previous records.


6) Detect price changes

Compare the latest snapshot with the previous one for the same product.

Example logic:

  • Fetch most recent two records for a product
  • If price differs, log the change
  • Trigger an alert

Pseudo-code:

if old_price != new_price:
    print(f"Price changed from {old_price} to {new_price}")

You may also want to track:

  • Percentage change
  • Stock status changes
  • Price drops only
  • Threshold-based alerts

7) Schedule scraping

Run the scraper regularly:

  • Cron: simplest for a server/VPS
  • GitHub Actions: good for lightweight periodic jobs
  • Airflow: for larger workflows
  • Celery/Redis: if you need distributed tasks

Example cron entry to run every 6 hours:

0 */6 * * * /usr/bin/python3 /path/to/scraper.py

8) Add alerting

When a price changes, notify yourself or a team.

Common channels:

  • Email
  • Slack webhook
  • Discord webhook
  • SMS via Twilio

Example Slack webhook request:

import requests

def send_slack_alert(message, webhook_url):
    requests.post(webhook_url, json={"text": message})

9) Handle common scraping issues

Merchant sites often change or block scrapers. Plan for:

  • HTML structure changes
  • Rate limiting / 429 responses
  • Bot detection
  • Missing/hidden prices
  • Multi-currency formatting
  • Regional pricing differences

Best practices:

  • Add retries with backoff
  • Use caching
  • Rotate user agents carefully and ethically
  • Keep selectors configurable per merchant
  • Log failures and monitor scraper health

10) Make it maintainable

If you’ll monitor many merchants, don’t hardcode each site. Use a config file like:

merchants:
  - name: "Store A"
    url: "https://storea.com/product/1"
    selectors:
      name: ".product-title"
      price: ".price"
  - name: "Store B"
    url: "https://storeb.com/item/9"
    selectors:
      name: "h1.title"
      price: ".cost"

This lets you add merchants without rewriting code.


Recommended architecture

A simple robust setup:

  • Scraper service: fetch product pages
  • Parser layer: extract fields per merchant
  • DB: store snapshots
  • Change detector: compare latest to prior data
  • Notifier: send alerts
  • Scheduler: run periodically

If you want a quick MVP

Start with:

  • Python
  • Requests + BeautifulSoup
  • SQLite
  • Cron
  • Email/Slack alerts

That’s enough for a small price-tracking tool.


If you want, I can also provide:

  1. a complete Python starter project,
  2. a database schema + scraper example, or
  3. a version using Playwright for JavaScript-heavy sites.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (3 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.