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.2.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.2-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.2.tar.gz.

File metadata

File hashes

Hashes for google_ai_mode_scraper_api-0.0.2.tar.gz
Algorithm Hash digest
SHA256 43273bf4fafdd147dfc51b728dba6ea0d389415343b8454c231bc70194ec646b
MD5 e68251f2212dc92cabcd723d7622925a
BLAKE2b-256 7b43e68582df89b6753a5b0ef73d3d8845bfca1ac32c79df54e50aed520af628

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for google_ai_mode_scraper_api-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b6b13b4b58ec557ffbeb256edc766b176156681f1bc6bbb56801f09e2a783603
MD5 db047a77a899f167349754e02db449d1
BLAKE2b-256 6af1d35b3bc983f2086ef56d692c095188adb11a6c9a281471cfe38e44f4137d

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