Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Google AI Mode Scraper

google-ai-mode-scraper

This is a working google ai mode scraper built on ScrapingBee's web scraping API. It sends a prompt into Google AI Mode and returns the generated answer, the pages Google cited, and the follow-up queries it suggests, as JSON, without you having to render or parse a single page yourself.

Why a plain HTTP request doesn't work here

Google AI Mode isn't a static results page. The answer is generated live, streamed into the page through JavaScript, and tied to the same session and device signals Google uses to serve regular search results. Point a bare requests.get() at it and you either get an empty shell or a block page, because there's no public REST endpoint behind the AI Mode UI, only the interactive front end.

ScrapingBee skips that problem entirely with a dedicated endpoint for Google's SERP surfaces, including AI Mode. You send the prompt as a parameter, ScrapingBee renders it against Google, and you get structured data back.

The dedicated endpoint

GET https://app.scrapingbee.com/api/v1/store/google

Authentication is a header, not a query parameter: send Authorization: Bearer YOUR_API_KEY with every request.

Parameter Required Notes
search yes The prompt to submit to AI Mode, capped at 400 characters
search_type yes Set to ai_mode
country_code no ISO 3166-1, defaults to us
language no Defaults to en
device no desktop or mobile
light_request no true (default, 10 credits) or false (15 credits)

ScrapingBee rejects anything over the 400-character cap before the request reaches Google.

Google AI Mode scraper API request in Python

import requests

API_KEY = "YOUR_SCRAPINGBEE_API_KEY"

response = requests.get(
    "https://app.scrapingbee.com/api/v1/store/google",
    params={
        "search": "best noise cancelling headphones under $200",
        "search_type": "ai_mode",
        "country_code": "us",
        "language": "en",
        "device": "desktop",
    },
    headers={"Authorization": f"Bearer {API_KEY}"},
)

data = response.json()
print(data["ai_overviews"])

Same request in Node

const axios = require('axios');

const API_KEY = 'YOUR_SCRAPINGBEE_API_KEY';

axios
  .get('https://app.scrapingbee.com/api/v1/store/google', {
    params: {
      search: 'best noise cancelling headphones under $200',
      search_type: 'ai_mode',
      country_code: 'us',
      language: 'en',
      device: 'desktop',
    },
    headers: { Authorization: `Bearer ${API_KEY}` },
  })
  .then((response) => {
    console.log(response.data.ai_overviews);
  });

Grab a key with 1,000 free credits at ScrapingBee to run either snippet.

Ready-made packages

The same client ships as an installable package for both ecosystems:

pip install google-ai-mode-scraper-api
from google_ai_mode_scraper_api import GoogleAiModeScraper

scraper = GoogleAiModeScraper(api_key="YOUR_SCRAPINGBEE_API_KEY")
print(scraper.search("best noise cancelling headphones under $200")["ai_overviews"])
npm install google-ai-mode-scraper-api
const { GoogleAiModeScraper } = require('google-ai-mode-scraper-api');
const scraper = new GoogleAiModeScraper({ apiKey: 'YOUR_SCRAPINGBEE_API_KEY' });
scraper.search('best noise cancelling headphones under $200').then((r) => console.log(r.ai_overviews));

What comes back

The response carries the AI-generated answer in ai_overviews, alongside the standard SERP fields the Google API returns for any search type: organic_results, related_queries, related_searches, questions, and meta_data. For an AI Mode query, ai_overviews is where the synthesized answer and its citations live, organic_results shows the pages ranking alongside it, and related_queries gives you the next prompts Google suggests, which is useful if you're mapping out how a topic branches inside AI Mode.

Credit cost

This is a dedicated endpoint, not the general-purpose HTML API, so there's no render_js, premium_proxy, or stealth_proxy to configure. Proxy rotation and rendering are bundled into the request price: light_request=true (the default) runs at 10 credits, and dropping to light_request=false for the fuller render costs 15. Compare that against building your own headless-browser fleet plus a residential proxy pool just to keep a scripted browser from getting blocked on Google's AI Mode surface. See the ScrapingBee pricing page for the full plan breakdown.

FAQ

What is Google AI Mode?

Google AI Mode is a separate, conversational search experience that generates a synthesized answer to a prompt, cites the sources it drew from, and suggests follow-up questions, distinct from the AI Overviews box that sometimes appears above regular search results.

How do you scrape Google AI Mode results?

Send the prompt through a search API that has a dedicated search_type=ai_mode parameter, like the one shown above. That avoids rendering the AI Mode interface yourself and sidesteps the anti-bot checks Google runs on scripted browser traffic.

Is there a character limit on AI Mode queries?

Yes. ScrapingBee's search_type=ai_mode request is capped at 400 characters; anything longer is rejected before it reaches Google.

Is scraping Google AI Mode allowed?

Treat it the same as scraping any public Google search result: pull data from the public-facing response, respect Google's terms and rate limits, and use the data for legitimate purposes like tracking AI visibility or citation coverage. ScrapingBee's own terms prohibit scraping behind a login, which doesn't apply here since AI Mode responses are publicly accessible.

Links

License

MIT