Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Google AI Mode Scraper API

Send prompts to Google AI Mode and reliably extract the AI Overview / AI Mode response - including the full answer text and its source citations - at scale, without blocks.

Powered by the NetNut LLM Scraper API. NetNut handles the proxy rotation, headless rendering, anti-bot handling, and throttling, so you just send a prompt and get back clean, structured JSON.

NetNut Google AI Mode Scraper API

Website Docs License


Table of contents


How it works

  1. You send a POST request to the NetNut LLM Scraper API endpoint with a prompt and the google-ai-mode engine.
  2. NetNut runs the prompt against Google AI Mode using its residential proxy network and rendering infrastructure.
  3. You receive structured JSON containing the AI response text and any citations Google attached to it. No HTML parsing required.

Endpoint

POST https://llm-scraper.netnut.io/search

Authentication - HTTP Basic Auth using your NetNut Scraper API credentials:

Authorization: Basic <base64(username:password)>

Who is this for?

This API is designed for SEO platforms, AI visibility and GEO tools, agencies, competitive intelligence providers, and enterprises that need to track, analyze, and monitor Google AI Mode results at scale.


Getting started

  1. Get NetNut LLM Scraper API credentials. Start here or contact NetNut.

  2. Copy the example environment file and add your own credentials:

    cp .env.example .env
    # then edit .env and set NETNUT_USERNAME / NETNUT_PASSWORD

    πŸ”’ Never commit credentials. .env is git-ignored. All examples read credentials from the NETNUT_USERNAME and NETNUT_PASSWORD environment variables - nothing is hardcoded.

  3. Pick your language from examples/ and run it (see each example's notes below).


Request sample

import os, requests

payload = {
    "prompt": "What are the leading SEO tips in 2025?",
    "engine": "google-ai-mode",
    "country": "us",
}

response = requests.post(
    "https://llm-scraper.netnut.io/search",
    auth=(os.environ["NETNUT_USERNAME"], os.environ["NETNUT_PASSWORD"]),
    json=payload,
    timeout=120,
)

print(response.json())

Request parameters

Parameter Type Required Default Description
prompt string Yes – The prompt/question to send to Google AI Mode. Max length: 4096 characters.
engine string Yes google-ai-mode The engine to scrape. Use google-ai-mode for Google AI Mode.
country string No – Target country for geo-relevant results (e.g. us, uk, de).

Output sample

{
  "timestamp": "2026-06-15T10:45:04.560Z",
  "traceID": "947ccf8a-6495-4904-ad9e-8bad19ee2e2a",
  "request_duration": 5.93,
  "process_duration": 5.93,
  "scraper": "Google-AI-Mode",
  "response": {
    "prompt": "best running shoes for beginners",
    "text": "Top Beginner Running Shoes\nThis shoe stands out as the ultimate multi-purpose option for new runners ...",
    "citations_found": true,
    "citations": [
      {
        "id": 1,
        "url": "https://runrepeat.com/uk/guides/best-for-beginners-running-shoes",
        "title": "RunRepeat (+3) – View related links",
        "description": "",
        "section": "citations"
      }
    ],
    "tables": [],
    "inline_citations": []
  }
}

The above is a trimmed, real response. tables and inline_citations are always present and populate when Google AI Mode includes comparison tables or inline source links.


Response structure

Field Type Description
timestamp string ISO 8601 timestamp of the response.
traceID string Unique identifier for the request (useful for support/debugging).
request_duration number Total request time in seconds.
process_duration number Processing time in seconds.
scraper string The scraper used - Google-AI-Mode.
response.prompt string The prompt that was sent.
response.text string The full Google AI Mode response text.
response.citations_found boolean Whether Google attached citations to the answer.
response.citations array List of citation objects (see below).
response.tables array Comparison tables extracted from the answer (empty if none).
response.inline_citations array Inline source links referenced within the answer text (empty if none).

Citation object

Field Type Description
id number Citation index.
url string Source URL.
title string Source title.
description string Short description of the source.
section string Section the citation belongs to.

Code examples

Ready-to-run examples live in examples/. Every example reads credentials from environment variables and prints the structured JSON response.

Language Path Notes
Python examples/python Uses requests.
Node.js examples/nodejs Uses built-in fetch (Node 18+).
Go examples/go Standard library only.
PHP examples/php Uses cURL extension.
Java examples/java Uses java.net.http (Java 11+).
C# examples/csharp .NET 8+.
Shell examples/shell curl one-liner.

Set your credentials first:

# macOS / Linux
export NETNUT_USERNAME="your-username"
export NETNUT_PASSWORD="your-password"
# Windows PowerShell
$env:NETNUT_USERNAME = "your-username"
$env:NETNUT_PASSWORD = "your-password"

Testing

Each example ships with a unit test suite that runs without making any live network calls.

Language Run command Requirements
Python cd examples/python && python -m pytest -v pip install -r requirements.txt
Node.js cd examples/nodejs && npm test npm install (no extra deps)
Go cd examples/go && go test ./... Go 1.21+
PHP cd examples/php && php test_main.php PHP 8.1+ with cURL extension
Java cd examples/java && java MainTest.java Java 21+
Shell cd examples/shell && bash test.sh bash, grep

Tests validate credential enforcement, request construction, Base64 auth encoding, error handling, and JSON output - without touching the network.


Use cases

  • AI search visibility (GEO/AEO). Track whether and how your brand appears in Google AI Mode answers.
  • Citation/source monitoring. See which domains Google cites for the prompts that matter to you.
  • Competitive intelligence. Compare how AI Mode describes you vs. competitors across countries.
  • Content optimization. Learn what AI Mode surfaces so you can optimize content to be cited.
  • Datasets & research. Collect AI responses at scale for analysis or model evaluation.

Why choose NetNut

  • 100M+ residential IPs - access one of the world's largest owned residential proxy networks.
  • Petabytes of monthly traffic - infrastructure built to support large-scale public web data operations.
  • #1 web data provider on G2 - recognized by customers for performance, reliability, and support.
  • NASDAQ-listed (ALAR) - backed by the transparency, stability, and accountability of a public company.
  • Built for enterprise scale - trusted by Fortune 500 companies and leading AI organizations.

FAQ

What is Google AI Mode? Google AI Mode is Google's AI-generated answer experience. This Scraper API returns the AI response text and the sources cited.

Do I need my own credentials? Yes. This repository contains no credentials. Bring your own NetNut LLM Scraper API credentials and set them as environment variables.

Is there a prompt length limit? Yes - prompts can be up to 4096 characters.

Can I target a specific country? Yes, pass country (e.g. us, uk, de).

What format is returned? Always structured JSON - never HTML.


Learn more

Contact us

Questions or need higher volume? Contact NetNut.


This project is licensed under the MIT License.

Releases

Packages

Contributors