Skip to main content

Google AI Mode Scraper API (Python)

A Python client for pulling structured data out of Google AI Mode, built on the ScrapingBee web scraping API. Hand it a prompt, and it returns the AI-generated answer, the sources it cited, and the follow-up queries Google suggests, all as a plain dictionary.

Install

pip install google-ai-mode-scraper-api

Quickstart

from google_ai_mode_scraper_api import GoogleAiModeScraper

scraper = GoogleAiModeScraper(api_key="YOUR_SCRAPINGBEE_API_KEY")

result = scraper.search("best noise cancelling headphones under $200")
print(result["ai_overviews"])

New accounts get 1,000 free credits at ScrapingBee, no card needed.

Returned data

search() returns the parsed JSON from ScrapingBee's Google Search API. The generated answer sits in ai_overviews; the rest of the response carries the standard SERP fields:

{
  "ai_overviews": {},
  "organic_results": [],
  "related_queries": [],
  "related_searches": [],
  "questions": [],
  "meta_data": {}
}

organic_results lists the pages ranking alongside the AI Mode answer, and related_queries gives you the next prompts Google is suggesting, which is useful for mapping out how a topic branches inside AI Mode.

Method reference

search(query, country_code="us", language="en", device="desktop", light_request=True, **extra)

Argument Default Notes
query required The prompt, capped at 400 characters (raises ValueError if longer)
country_code "us" ISO 3166-1
language "en"
device "desktop" "desktop" or "mobile"
light_request True True costs 10 credits; False renders the fuller page for 15
**extra Any extra ScrapingBee parameter, passed straight through

The 400-character limit

Google caps the AI Mode input box at 400 characters, and ScrapingBee's search_type=ai_mode request enforces the same limit. This client checks the length client-side and raises before spending a credit on a query that would be rejected:

scraper.search("a" * 500)  # raises ValueError, no request sent

Credit cost

light_request=True (the default) runs at 10 ScrapingBee credits. Set light_request=False for the fuller render at 15 credits. This is a dedicated endpoint, so there's no separate proxy or rendering flag to configure, unlike the general-purpose HTML API. Full breakdown on ScrapingBee pricing.

Requirements and scope

Python 3.8 or newer and a ScrapingBee API key. This is an independent wrapper on the public ScrapingBee API, not affiliated with Google, and it targets Google's publicly accessible AI Mode responses only.

Links

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

google_ai_mode_scraper_api-0.0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

google_ai_mode_scraper_api-0.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file google_ai_mode_scraper_api-0.0.1.tar.gz.

File metadata

File hashes

Hashes for google_ai_mode_scraper_api-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f5d43593f082af66d0ff677c6a656cb3a0d1dd133eb3563daa4c97c746e982a4
MD5 da9a443c9effe89de75f059983afb033
BLAKE2b-256 3b0b4e625c847924044274a548f45af0c796e22ccc6008b550ad9dfbdb3d7eec

See more details on using hashes here.

File details

Details for the file google_ai_mode_scraper_api-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for google_ai_mode_scraper_api-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8710702f2eda5c4e7c225e002e458a9d2ec5c7b91186c00a00c0ac44540bf958
MD5 306f4b776d9d8ee5fca55770538019f7
BLAKE2b-256 f247bf57d809d578ece6d8417e3224fc4aba6395059dd4f58c16a91b90836b27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page