Tutorial

How to Build Programmatic SaaS Comparison Pages

Generate template-driven 'X vs Y' comparison pages with live pricing data from SERP API. Scale to hundreds of pages automatically.

SaaS comparison pages like 'Scavio vs SerpAPI' capture high-intent search traffic from buyers actively evaluating tools. Building them manually takes hours per page, but a template-driven approach with live pricing data from a SERP API scales to hundreds of pages automatically. Each pricing verification costs $0.005, so validating 100 comparison pages costs $0.50.

Prerequisites

  • Python 3.8+
  • requests library
  • A Scavio API key from scavio.dev
  • A list of competitor pairs to compare

Walkthrough

Step 1: Define the comparison template

Create a reusable template structure for X vs Y pages.

Python
import os, requests, json

API_KEY = os.environ['SCAVIO_API_KEY']
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}

def comparison_template(tool_a, tool_b):
    return {
        'slug': f'{tool_a.lower().replace(" ", "-")}-vs-{tool_b.lower().replace(" ", "-")}',
        'title': f'{tool_a} vs {tool_b}: Which Is Better in 2026?',
        'meta_title': f'{tool_a} vs {tool_b} Comparison (2026)',
        'meta_description': f'Compare {tool_a} and {tool_b} side by side: pricing, features, API design, and real user feedback. Updated May 2026.',
        'sections': ['quick_verdict', 'pricing_table', 'feature_comparison',
                     'user_feedback', 'when_to_choose_each', 'methodology']
    }

template = comparison_template('Scavio', 'SerpAPI')
print(f'Page: {template["slug"]}')
print(f'Title: {template["title"]}')
print(f'Sections: {", ".join(template["sections"])}')

Step 2: Fetch live pricing and feature data

Use SERP data to get current pricing and feature information.

Python
def fetch_tool_data(tool_name):
    """Get current data about a tool from search results."""
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': f'{tool_name} pricing 2026', 'country_code': 'us'}).json()
    organic = data.get('organic_results', [])[:3]
    pricing_snippet = ''
    for r in organic:
        snippet = r.get('snippet', '')
        if any(w in snippet.lower() for w in ['$', 'free', 'pricing', 'month', 'credit']):
            pricing_snippet = snippet[:200]
            break
    # Reddit sentiment
    reddit = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': f'{tool_name} review', 'platform': 'reddit', 'country_code': 'us'}).json()
    reddit_mentions = len(reddit.get('organic_results', []))
    return {
        'name': tool_name,
        'pricing_snippet': pricing_snippet,
        'reddit_mentions': reddit_mentions,
        'top_result': organic[0].get('title', '')[:60] if organic else 'N/A'
    }

for tool in ['Scavio', 'SerpAPI']:
    info = fetch_tool_data(tool)
    print(f'{tool}:')
    print(f'  Pricing: {info["pricing_snippet"][:80]}')
    print(f'  Reddit mentions: {info["reddit_mentions"]}')

Step 3: Generate comparison content from template

Fill the template with data to produce page content.

Python
def generate_comparison(tool_a_name, tool_b_name, tool_a_data, tool_b_data):
    """Generate comparison page content from template and data."""
    template = comparison_template(tool_a_name, tool_b_name)
    content = {
        **template,
        'intro': f'{tool_a_name} and {tool_b_name} both provide search API services. This comparison uses verified pricing data and real user feedback from Reddit to help you choose.',
        'pricing': {
            tool_a_name: tool_a_data['pricing_snippet'],
            tool_b_name: tool_b_data['pricing_snippet']
        },
        'user_sentiment': {
            tool_a_name: f'{tool_a_data["reddit_mentions"]} Reddit discussions',
            tool_b_name: f'{tool_b_data["reddit_mentions"]} Reddit discussions'
        },
        'last_verified': '2026-05-19'
    }
    return content

a_data = fetch_tool_data('Scavio')
b_data = fetch_tool_data('SerpAPI')
page = generate_comparison('Scavio', 'SerpAPI', a_data, b_data)
print(f'\nGenerated: {page["title"]}')
print(f'Slug: {page["slug"]}')
print(f'Last verified: {page["last_verified"]}')

Step 4: Scale to many comparison pages

Generate comparison pages for all competitor pairs automatically.

Python
def batch_generate(tools):
    """Generate comparison pages for all pairs."""
    from itertools import combinations
    pairs = list(combinations(tools, 2))
    pages = []
    total_cost = 0
    for a, b in pairs:
        a_data = fetch_tool_data(a)
        b_data = fetch_tool_data(b)
        total_cost += 4 * 0.005  # 2 Google + 2 Reddit searches
        page = generate_comparison(a, b, a_data, b_data)
        pages.append(page)
        print(f'  Generated: {page["slug"]}')
    print(f'\nGenerated {len(pages)} comparison pages')
    print(f'Total cost: ${total_cost:.3f}')
    print(f'Cost per page: ${total_cost/len(pages):.4f}')
    # Save all pages
    with open('comparison_pages.json', 'w') as f:
        json.dump(pages, f, indent=2)
    print(f'Saved to comparison_pages.json')
    return pages

tools = ['Scavio', 'SerpAPI', 'DataForSEO', 'Serper', 'Tavily']
pages = batch_generate(tools)

Python Example

Python
import os, requests
SH = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}

def vs_page(tool_a, tool_b):
    for tool in [tool_a, tool_b]:
        data = requests.post('https://api.scavio.dev/api/v1/search',
            headers=SH, json={'query': f'{tool} pricing 2026', 'country_code': 'us'}).json()
        snippet = (data.get('organic_results') or [{}])[0].get('snippet', '')[:80]
        print(f'{tool}: {snippet}')
    print(f'Page: {tool_a.lower()}-vs-{tool_b.lower()} | Cost: $0.010')

vs_page('Scavio', 'SerpAPI')

JavaScript Example

JavaScript
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
async function vsPage(toolA, toolB) {
  for (const tool of [toolA, toolB]) {
    const data = await fetch('https://api.scavio.dev/api/v1/search', {
      method: 'POST', headers: SH,
      body: JSON.stringify({ query: `${tool} pricing 2026`, country_code: 'us' })
    }).then(r => r.json());
    console.log(`${tool}: ${(data.organic_results||[{}])[0]?.snippet?.slice(0,80) || 'N/A'}`);
  }
  console.log(`Page: ${toolA.toLowerCase()}-vs-${toolB.toLowerCase()}`);
}
vsPage('Scavio', 'SerpAPI').catch(console.error);

Expected Output

JSON
Page: scavio-vs-serpapi
Title: Scavio vs SerpAPI: Which Is Better in 2026?
Sections: quick_verdict, pricing_table, feature_comparison, user_feedback, when_to_choose_each, methodology

Scavio:
  Pricing: Scavio offers a free tier with 250 credits/month. Paid plans start at $30...
  Reddit mentions: 8
SerpAPI:
  Pricing: SerpAPI pricing starts at $25/month for 1,000 searches...
  Reddit mentions: 12

Generated 10 comparison pages
Total cost: $0.200
Cost per page: $0.0200

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.8+. requests library. A Scavio API key from scavio.dev. A list of competitor pairs to compare. A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Generate template-driven 'X vs Y' comparison pages with live pricing data from SERP API. Scale to hundreds of pages automatically.