
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.
AlterLab handles this automatically — scrape any URL with one API call. No infrastructure required.
Try it freeTL;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:
- Fingerprinting: Detecting unique signatures in your TLS handshake or header order.
- JavaScript Rendering: Many pages require a full browser engine to populate the DOM with data.
- 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
import alterlab
client = alterlab.Client("YOUR_API_KEY")
response = client.scrape("https://semrush.com/example-page")
print(response.text)Node.js Implementation
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
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.
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 outputTry 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.
| Tier | Use Case | Cost per Request | Cost per 1,000 | Requests per $1 |
|---|---|---|---|---|
| T1 — Curl | Static HTML, no JS needed | $0.0002 | $0.20 | 5,000 |
| T2 — HTTP | Standard pages with headers | $0.0003 | $0.30 | 3,333 |
| T3 — Stealth | Protected pages, anti-bot active | $0.002 | $2.00 | 500 |
| T4 — Browser | Full JS rendering required | $0.004 | $4.00 | 250 |
| T5 — CAPTCHA | CAPTCHA solving + JS rendering | $0.02 | $20.00 | 50 |
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.txtto 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:
- Batching: Group your URLs and process them in asynchronous batches.
- Scheduling: Use cron-based scheduling to automate recurring scrapes for time-sensitive data.
- Webhooks: Instead of polling the API for results, configure webhooks to push data directly to your server or S3 bucket.
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.
Was this article helpful?
Frequently Asked Questions
Related Articles

How to Scrape SimilarWeb Data: Complete Guide for 2026
Learn how to scrape SimilarWeb public data using Python and Node.js. Master anti-bot bypass, structured extraction with Cortex AI, and scalable API pipelines.
Herald Blog Service

How to Scrape Statista Data: Complete Guide for 2026
Learn how to scrape Statista data responsibly using Python, Node.js, and AlterLab's anti-bot API in 2026.
Herald Blog Service

How to Monitor Website Changes and Get Alerted on Content Updates
Learn how to set up automated change detection with AlterLab’s scraping API, configure webhook alerts, and integrate monitoring into your data pipelines using Python or cURL.
Herald Blog Service
Popular Posts
Recommended

How to Scrape AliExpress: Complete Guide for 2026

Why Your Headless Browser Gets Detected (and How to Fix It)

AlterLab vs Firecrawl: In-Depth Review with Benchmarks & Code Examples

How to Scrape Twitter/X Data: Complete Guide for 2026

How to Scrape Cloudflare-Protected Sites in 2026
Newsletter
Scraping insights and API tips. No spam.
Recommended Reading

How to Scrape AliExpress: Complete Guide for 2026

Why Your Headless Browser Gets Detected (and How to Fix It)

AlterLab vs Firecrawl: In-Depth Review with Benchmarks & Code Examples

How to Scrape Twitter/X Data: Complete Guide for 2026

How to Scrape Cloudflare-Protected Sites in 2026
Stay in the Loop
Get scraping insights, API tips, and platform updates. No spam — we only send when we have something worth reading.
Explore AlterLab
Web Scraping API Resources
Part of the Web Scraping API Documentation cluster
Complete API reference with 5-tier auto-escalation — Curl to challenge resolution.
Pillar pageConfigure Tier 4 browser rendering for SPAs and dynamic content.
Scrape pages behind login using session management.
Real success rates and cost data across all 5 tiers.
MCP Server, Python SDK, and Firecrawl-compatible API for AI agent workflows.