How to Scrape SEMrush Data: Complete Guide for 2026
Tutorials

How to Scrape SEMrush Data: Complete Guide for 2026

Learn how to scrape SEMrush public data using Python and Node.js. This guide covers handling anti-bot protections, structured AI extraction, and scaling pipelines.

H
Herald Blog Service
4 min read
2 views

AlterLab handles this automaticallyscrape any URL with one API call. No infrastructure required.

Try it free

TL;DR

To scrape SEMrush public data, use the AlterLab API to handle anti-bot protections and proxy rotation automatically. For structured data, use the Cortex AI engine to transform raw HTML into typed JSON without writing complex CSS selectors.

Disclaimer: This guide covers extracting publicly accessible data. Always review a site's robots.txt and Terms of Service before scraping.

Why collect data from SEMrush?

Data engineers and market analysts often need to monitor public-facing SEO metrics and domain insights. Common use cases include:

  • Market Research: Tracking keyword trends and domain authority shifts across entire industry sectors.
  • Competitive Intelligence: Monitoring changes in search visibility or traffic estimates for specific public domains.
  • Data Analysis: Aggregating public SEO signals to train machine learning models for search intent prediction.

Technical challenges

Scraping high-security domains like semrush.com presents significant hurdles for standard HTTP libraries. Most modern data platforms employ sophisticated anti-bot layers that detect and block non-browser traffic.

The primary challenges include:

  1. Fingerprinting: Detecting unique signatures in your TLS handshake or header order.
  2. JavaScript Rendering: Many pages require a full browser engine to populate the DOM with data.
  3. IP Reputation: Frequent requests from a single IP will trigger immediate blocks.

To handle these, you need a Smart Rendering API that can escalate from simple HTTP requests to full headless browser sessions automatically.

Quick start with AlterLab API

You can start extracting data immediately using Python, Node.js, or a simple cURL command. Follow our Getting started guide to set up your environment.

Python Implementation

Python
import alterlab

client = alterlab.Client("YOUR_API_KEY")
response = client.scrape("https://semrush.com/example-page")
print(response.text)

Node.js Implementation

JAVASCRIPT
import { AlterLab } from "alterlab";

const client = new AlterLab({ apiKey: "YOUR_API_KEY" });
const response = await client.scrape("https://semrush.com/example-page");
console.log(response.text);

cURL Implementation

Bash
curl -X POST https://api.alterlab.io/v1/scrape \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{"url": "https://semrush.com/example-page"}'

Extracting structured data

Once you have the raw HTML, the next step is parsing. While you can use libraries like BeautifulSoup or Cheerio, CSS selectors are brittle; if the site changes a single class name, your pipeline breaks.

For most public pages, you can target specific elements using standard paths. However, for complex layouts, we recommend moving toward AI-driven extraction.

Structured JSON extraction with Cortex

Instead of maintaining a library of brittle CSS selectors, use Cortex. This feature uses LLMs to understand the page context and return typed JSON. You define the schema, and the engine handles the extraction.

Python
import alterlab

client = alterlab.Client("YOUR_API_KEY")
result = client.extract(
    url="https://semrush.com/example-page",
    schema={
        "type": "object",
        "properties": {
            "domain_authority": {"type": "number"},
            "top_keywords": {"type": "array", "items": {"type": "string"}},
            "traffic_estimate": {"type": "string"},
            "description": {"type": "string"}
        }
    }
)
print(result.data)  # Typed JSON output
Try it yourself

Try scraping SEMrush with AlterLab

Cost breakdown

For SEMrush, we recommend starting with Tier 3 (Stealth) or Tier 4 (Browser) to ensure successful access through anti-bot layers.

TierUse CaseCost per RequestCost per 1,000Requests per $1
T1 — CurlStatic HTML, no JS needed$0.0002$0.205,000
T2 — HTTPStandard pages with headers$0.0003$0.303,333
T3 — StealthProtected pages, anti-bot active$0.002$2.00500
T4 — BrowserFull JS rendering required$0.004$4.00250
T5 — CAPTCHACAPTCHA solving + JS rendering$0.02$20.0050

Note: AlterLab auto-escalates tiers. Start at T1 and the API promotes automatically if a lower tier fails. You only pay for the tier that succeeds. View full AlterLab pricing for details.

Best practices

To maintain a healthy scraping pipeline and avoid being flagged, follow these engineering principles:

  • Respect Rate Limits: Even when using rotating proxies, do not hammer a single domain with thousands of concurrent requests.
  • Respect robots.txt: Always check the target's /robots.txt to see which paths are off-limits.
  • Handle Errors Gracefully: Implement retry logic with exponential backoff for network-level failures.
  • Monitor Success Rates: Use webhooks to get notified when a specific scraping job fails or requires a higher tier.

Scaling up

When moving from single requests to millions of data points, you should implement:

  1. Batching: Group your URLs and process them in asynchronous batches.
  2. Scheduling: Use cron-based scheduling to automate recurring scrapes for time-sensitive data.
  3. Webhooks: Instead of polling the API for results, configure webhooks to push data directly to your server or S3 bucket.
99.2%Success Rate
1.2sAvg Response
$0.002Per Request (T3)

Key takeaways

  • Automation is essential: Use AlterLab's auto-escalation to handle anti-bot protections without manual intervention.
  • Structured data is better: Use Cortex AI to avoid the maintenance headache of CSS selectors.
  • Scale responsibly: Use scheduling and webhooks to build robust, production-grade data pipelines.

For more specialized implementations, see our SEMrush scraping guide.

Share

Was this article helpful?

Frequently Asked Questions

Scraping publicly accessible data is generally legal, but users must comply with a site's robots.txt and Terms of Service. Always implement rate limiting and avoid accessing private or login-protected data.
SEMrush employs advanced anti-bot protections that require rotating proxies and browser-like headers to access public pages. AlterLab handles these complexities via automatic tier escalation.
Costs range from $0.0002 for static HTML to $0.004 for full JS rendering. AlterLab's auto-escalation ensures you only pay for the specific tier required for a successful request.