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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file google_ai_mode_scraper_api-0.0.1.tar.gz.
File metadata
- Download URL: google_ai_mode_scraper_api-0.0.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5d43593f082af66d0ff677c6a656cb3a0d1dd133eb3563daa4c97c746e982a4
|
|
| MD5 |
da9a443c9effe89de75f059983afb033
|
|
| BLAKE2b-256 |
3b0b4e625c847924044274a548f45af0c796e22ccc6008b550ad9dfbdb3d7eec
|
File details
Details for the file google_ai_mode_scraper_api-0.0.1-py3-none-any.whl.
File metadata
- Download URL: google_ai_mode_scraper_api-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8710702f2eda5c4e7c225e002e458a9d2ec5c7b91186c00a00c0ac44540bf958
|
|
| MD5 |
306f4b776d9d8ee5fca55770538019f7
|
|
| BLAKE2b-256 |
f247bf57d809d578ece6d8417e3224fc4aba6395059dd4f58c16a91b90836b27
|