DEV Community

Cover image for How to Crawl and Analyze an Entire Competitor Site with One API Call
Aman Deep Singh
Aman Deep Singh

Posted on

How to Crawl and Analyze an Entire Competitor Site with One API Call

Market research without writing crawler pipelines, managing link queues, or maintaining fragile scrapers.

[!NOTE]
TL;DR / Quick Summary:

  • Use Case: Domain-wide crawling for competitive intelligence, content strategy audits, pricing catalog dumps, and market research.
  • Missuri Automation: Crawls entire link graphs, filters pages using hybrid BM25 + Vector similarity ranking, and auto-extracts structured JSON schemas directly to CSV/DataFrames.
  • Cost Reality: Crawling and extracting an entire 500-page website costs ~136 tokens (~$0.82 on the $30 Growth Plan).
  • Python SDK: pip install scraping-ai
  • Zero-Risk Trial: Get 200 free tokens (no credit card required) at https://pig-data.jp/service/scraping-ai/.

The Market Research Data Problem

Conducting competitive analysis often requires comprehensive website data:

  • What content categories are competitors prioritizing?
  • Which authors drive their organic publishing output?
  • What are the specific content gaps in your own product strategy?

Traditionally, collecting this data meant writing custom Scrapy spiders, handling pagination depth, filtering out 404s and legal pages, and constantly fixing broken CSS selectors.

With Scraping AI's domain crawling engine, you can crawl an entire website and extract structured records using a single Python script.


The 3-Step Extraction & Ranking Pipeline

[Target Domain URL]
          │
          ▼
   ┌─────────────┐
   │ URL Finder  │ (Discovers link graph up to max_depth)
   └─────────────┘
          │
          ▼
   ┌─────────────┐
   │ AI Ranker   │ (BM25 + Vector relevance filtering)
   └─────────────┘
          │
          ▼
   ┌─────────────┐
   │ LLM Extractor│ (Applies JSON Schema to all relevant pages)
   └─────────────┘
          │
          ▼
   [Structured JSON / Pandas DataFrame / CSV]
Enter fullscreen mode Exit fullscreen mode

1. Link Graph Discovery

The crawler explores the target domain recursively up to your specified url_finder_depth (e.g., 5 levels deep) and link limits.

2. Hybrid BM25 & Vector Relevance Ranking

Raw crawlers inevitably pick up hundreds of irrelevant pages (e.g., /privacy-policy, /terms, /cookie-settings). Scraping AI calculates semantic relevance scores combining keyword frequency (BM25) and vector embeddings, automatically discarding noise.

3. LLM Schema Extraction & 1-Click CSV Export

The engine applies your JSON schema to all top-ranked pages in parallel, returning clean, normalized output directly loadable into Pandas or downloadable as CSV.


Full Tutorial: Crawling & Pandas Analysis

pip install scraping-ai pandas
Enter fullscreen mode Exit fullscreen mode
from scraping_ai import ScrapingAIClient
import pandas as pd

# 1. Initialize client
client = ScrapingAIClient(api_key="YOUR_API_KEY")

# 2. Create whole-site crawling task
state = client.pipeline.create(
    base_url="https://competitor-blog.com",
    site_type="general",
    user_instruction="Extract all blog post metadata: title, author, publish date, category, word count",
    schema_instruction="Blog post with title, author, date, category, word_count, and URL",
    url_finder_depth=5,
    url_finder_limit=1000,
    ranking_approach="hybrid",
    top_url_cutoff=0.3,
    auto_flow=True
)

# 3. Trigger and await completion
client.pipeline.run_flow(state.id)
final_state = client.pipeline.wait_for_task(state.id, poll_interval=10.0)

# 4. Fetch extracted data and export to CSV
data = client.data.get_by_state(state.id, page_size=1000)
df = pd.DataFrame([post['data'] for post in data.results])
df.to_csv("competitor_audit.csv", index=False)

print(f"Extracted {len(df)} records and saved to competitor_audit.csv!")

# 5. Analyze content strategy
print("Top Categories:")
print(df['category'].value_counts())

print("\nTop Contributing Authors:")
print(df['author'].value_counts().head(10))
Enter fullscreen mode Exit fullscreen mode

Content Gap Analysis: Finding Missing Topics

def find_content_gaps(your_titles: list, competitor_titles: list):
    """Identify topics your competitor covers that you don't."""
    your_words = set(w.lower() for title in your_titles for w in title.split() if len(w) > 4)
    comp_words = set(w.lower() for title in competitor_titles for w in title.split() if len(w) > 4)

    gaps = comp_words - your_words
    print(f"Discovered {len(gaps)} potential keyword gap opportunities!")
    return gaps
Enter fullscreen mode Exit fullscreen mode

Token Economics: How Much Does a 500-Page Crawl Cost?

Pipeline Step Tokens Required
Task Start & URL Discovery (500 URLs) ~11 tokens
Page Crawling & Vector Relevance Ranking ~75 tokens
LLM Structured Extraction ~50 tokens
Total Cost for 500-Page Website ~136 tokens (~$0.82 on Growth Plan)

Honest Limitations

  • Login Walls: Content requiring user authentication or paywalls cannot be scraped.
  • Large Files: Media files or raw HTML snapshots exceeding 5MB are timed out.
  • Social Platforms: Scraping social media feeds is explicitly excluded.

Start Extracting in 60 Seconds

  1. Sign up for a free developer account: https://pig-data.jp/service/scraping-ai/
  2. Claim 200 free tokens (Instantly credited, no credit card required)
  3. Install the Python SDK: pip install scraping-ai
  4. Run your whole-site crawl!

Pricing Tiers: Free (200 tokens) → Starter ($10 / 1,600 tokens) → Growth ($30 / 5,000 tokens) → Pro ($100 / 20,000 tokens)

API Documentation: https://pig-data.jp/service/scraping-ai/docs/


About the Team & Company

Scraping AI (https://pig-data.jp/service/scraping-ai/) is developed and operated by indigodata Inc., an AI venture subsidiary of SMS DataTech Co., Ltd. (Tokyo, Japan). Built upon PigData's track record of 500+ enterprise data extraction projects, Scraping AI provides a self-serve LLM extraction API for developers worldwide.

Top comments (0)