cd /news/generative-engine-optimization/pulling-semrush-ai-visibility-and-se… · home › topics › generative-engine-optimization › article
[ARTICLE · art-182924] src=dev.to ↗ pub= topic=generative-engine-optimization verified=true sentiment=↑ positive

Pulling Semrush AI Visibility and SEO Metrics with Python

A developer published a Python workflow that uses the Semrush All-in-One Scraper on Apify to pull classic SEO metrics and AI Search visibility data in a single request. The actor's domain mode returns authority scores, traffic, backlink profiles, and per-LLM mention and citation counts across ChatGPT, Google AI Overview, AI Mode, and Gemini, with an example script using apify-client and pandas to snapshot competitor domains to CSV. The author notes the actor supports up to 100 domains per run with configurable concurrency, avoiding manual exports for agencies tracking dozens of rivals.

key takeaway

Semrush's domain-mode scraper returns AI visibility, per-LLM mention counts, and cited pages alongside classic SEO metrics in one JSON call, so a 50-domain portfolio can be snapshotted in a single run at concurrency 20 instead of looping single-domain requests.

by read3 min views1 publishedDec 6, 2026

Most SEO dashboards still treat Google blue links as the whole picture. Over the past year, though, clients started asking a harder question: how often do ChatGPT, Gemini, and Google AI Overviews actually cite our domain compared to our rivals?

You can click through Semrush by hand to check this, domain by domain, or pay for API add-on units on top of a monthly seat. When you track 30 to 100 competitor domains every Monday, manual exports break down fast.

One practical alternative is running the Semrush All-in-One Scraper on Apify. It has over 4,600 users and more than 320,000 runs, and it packages four distinct modes (domain, keyword, seo_audit, and top_websites) behind one JSON interface.

In domain mode, a single request pulls both classic SEO totals and AI Search visibility into one flat-plus-nested JSON object:

Metric group Example fields returned
Domain authority authority_score ,moz_domain_authority ,moz_spam_score
Search traffic organic_traffic ,total_traffic ,organic_keywords ,paid_traffic
Link profile backlinks ,referring_domains ,backlinks_list ,referring_domains_list
AI Search ai_visibility ,ai_mentions ,ai_cited_pages ,ai_search.by_llm

The ai_search.by_llm section breaks down mentions and cited pages across ChatGPT, Google AI Overview, AI Mode, and Gemini. It also includes top_cited_sources, which lists third-party sites that models frequently cite alongside a domain. For digital PR teams, that list is basically a ready-made outreach target sheet.

Row-level lists are opt-in, so you do not have to haul megabytes of nested arrays when you only need headline KPIs. Toggle include_organic_keywords, include_backlinks (up to 80 per domain via backlinks_limit), or include_referring_domains (up to 60 via referring_domains_limit) whenever you want deeper tables.

Here is a small script using apify-client and pandas that checks a batch of SaaS competitors in the US database, grabs their Moz scores and top keywords, and saves a clean CSV snapshot.

import os
import pandas as pd
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])

run_input = {
    "mode": "domain",
    "domains": ["backlinko.com", "ahrefs.com", "moz.com", "searchengineland.com"],
    "database": "us",
    "include_moz": True,
    "include_organic_keywords": True,
    "include_backlinks": True,
    "backlinks_limit": 20,
    "concurrency": 20,
}

run = client.actor("pro100chok/semrush-scraper").call(run_input=run_input)
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())

rows = []
for item in items:
    by_llm = {
        entry["llm"]: entry.get("mentions", 0)
        for entry in item.get("ai_search", {}).get("by_llm", [])
    }
    rows.append({
        "domain": item.get("domain"),
        "authority_score": item.get("authority_score"),
        "organic_traffic": item.get("organic_traffic"),
        "referring_domains": item.get("referring_domains"),
        "ai_visibility": item.get("ai_visibility"),
        "chatgpt_mentions": by_llm.get("ChatGPT", 0),
        "ai_overview_mentions": by_llm.get("AI Overview", 0),
        "moz_da": item.get("moz_domain_authority"),
    })

df = pd.DataFrame(rows).sort_values("ai_visibility", ascending=False)
df.to_csv("weekly_seo_ai_snapshot.csv", index=False)
print(df.to_string(index=False))

Notice concurrency: 20. Because the actor accepts up to 100 domains per run, a 50-domain agency portfolio finishes in one short job instead of looping through single-domain requests.

If you already have this actor wired into your pipeline, you can reuse the exact same API call pattern for three adjacent tasks:

keyword`` keywords and pick a regional database (90+ countries or worldwide). You get search volume, CPC, Keyword Difficulty, search intent, 12-month trend data, related questions, and live SERP snapshots.seo_audit`` response_time_ms, h1_count, word_count, images_missing_alt, canonical, has_robots_txt, and has_sitemap right next to the domain's Semrush organic context.top_websites`` country_top_websites and industry_top_websites for market sizing. Instead of paying a recurring monthly subscription just to export a few hundred rows, billing is strictly pay-per-event on each dataset result returned: $4.00 per 1,000 results on paid Apify plans ($15.00 per 1,000 on the free tier).

For a weekly check of 50 domains (200 results a month), that comes out to roughly $0.80 a month on a paid Apify plan. Even if you run quarterly audits on 1,000 domains, you only spend $4.00 and keep your pipeline completely serverless.

If your team needs Semrush domain metrics, backlink samples, and per-LLM AI Search visibility inside Python notebooks, Looker Studio, or automated Slack alerts, give the Semrush All-in-One Scraper a test run on five of your own URLs first. Inspect the nested JSON once, map the columns you care about, and schedule it to run while you sleep.

── more in #generative-engine-optimization 4 stories · sorted by recency
── more on @semrush 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/pulling-semrush-ai-v…] indexed:0 read:3min 2026-12-06 · —