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

Metadata

Release files for google-ai-mode-scraper-api 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for google-ai-mode-scraper-api 0.0.2
File Size Uploaded
google_ai_mode_scraper_api-0.0.2.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for google-ai-mode-scraper-api 0.0.2
File Interpreter ABI Platform
google_ai_mode_scraper_api-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / google_ai_mode_scraper_api-0.0.2.tar.gz

Download URL google_ai_mode_scraper_api-0.0.2.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
43273bf4fafdd147dfc51b728dba6ea0d389415343b8454c231bc70194ec646b
BLAKE2b-256 checksum
How to use checksums
7b43e68582df89b6753a5b0ef73d3d8845bfca1ac32c79df54e50aed520af628
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / google_ai_mode_scraper_api-0.0.2-py3-none-any.whl

Download URL google_ai_mode_scraper_api-0.0.2-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6b13b4b58ec557ffbeb256edc766b176156681f1bc6bbb56801f09e2a783603
BLAKE2b-256 checksum
How to use checksums
6af1d35b3bc983f2086ef56d692c095188adb11a6c9a281471cfe38e44f4137d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page