# Google AI Mode Answer & Citation Scraper (`xyrelith-data/google-ai-mode-scraper`) Actor

Run prompts through Google AI Mode (udm=50) in any country and language and export each answer as text and markdown with its cited sources, inline citation groups, product and place cards, follow-up questions and brand or domain visibility scores.

- **URL**: https://apify.com/xyrelith-data/google-ai-mode-scraper.md
- **Developed by:** [Xyrelith Data](https://apify.com/xyrelith-data) (community)
- **Categories:** AI, SEO tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.49 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Google AI Mode Answer & Citation Scraper

Ask Google AI Mode (`udm=50`) a list of prompts in one or more countries, in any supported language, and get one structured record per prompt and country. Every record contains the full answer as clean plain text and as markdown, every cited source with its position, the inline citation groups Google shows, product cards, local place cards, follow-up questions, and brand/domain visibility scores.

No Google account, cookies, API key or proxy setup is required.

### What it returns

| Field | What it is |
|---|---|
| `prompt`, `countryCode`, `country`, `languageCode` | The exact prompt and market that produced the answer. |
| `status` | `OK`, `NO_ANSWER` or `BLOCKED`. |
| `aiModeUrl` | The AI Mode URL that produced the answer. |
| `answerText` | The complete answer as clean plain text. |
| `answerMarkdown` | The same answer as markdown, keeping section headings, bold text, bullet lists, tables and inline citation markers. |
| `answerLength`, `answerWordCount` | Size of the answer. |
| `textBlocks` | The answer split into typed blocks (paragraph, heading, list_item, table). |
| `tables` | Comparison tables as `headers` + `rows`. |
| `sources` | Every cited source: `position`, `title`, `siteName`, `domain`, publisher `url`, `snippet`, `faviconUrl`, and the `citationGroups` that cite it. Google redirect links are resolved to the publisher URL; when a redirect cannot be resolved the original link is kept with `urlType: unresolvedGoto`. |
| `citationGroups` | The inline citation chips (for example `RunRepeat +5`) with their character `position` in the answer, the publisher, the number of additional sources and the sources behind each one. |
| `products` | Product cards Google embeds in the answer: name, price, currency, merchant, rating, review count, "Best For", "Support Tech", "Key Specs", "Expert Take" and "Buyer Feedback" when present. |
| `places` | Local place cards when Google shows them: name, category, rating, review count, price range, open/closed status, address, description, website, directions link, Google place ID and coordinates. |
| `followUpQuestions`, `followUpPrompt` | The follow-up directions Google suggests at the end of the answer. |
| `brandVisibility` | For each brand you supply: mentioned yes/no, mention count, first mention position, cited-as-source yes/no and the source positions that cite it. |
| `domainVisibility` | The same scoring for domains. |
| `grounded` | `true` when the answer shows at least one source card. Some answers come back without any sources; the record is still returned, with `grounded: false`. |
| `responseTimestamp`, `scrapedAt` | When the answer was captured. |

### Input

| Input | Default | Description |
|---|---|---|
| `prompts` | – (required) | One or more questions or search prompts. Each prompt is asked once per selected country. |
| `countries` | `["us"]` | One or more Google markets (`gl`). The answer is localized for the selected country. |
| `languageCode` | `en` | Interface and answer language (`hl`). Write the prompts in that language for best results. |
| `brands` | – | Optional brand names for AI visibility scoring. |
| `domains` | – | Optional domains for citation and mention scoring. |
| `includeProductCards` | `true` | Extract product cards from the answer. |
| `includePlaceCards` | `true` | Extract local place cards from the answer. |
| `includeFollowUpQuestions` | `true` | Extract the follow-up directions Google suggests. |
| `includeMarkdown` | `true` | Save the answer as markdown in addition to plain text. |
| `maxItems` | `100` | Stop after this many answers. Each prompt x country pair is one answer. |

#### Example input

```json
{
  "prompts": [
    "best running shoes for flat feet",
    "best coffee shops in Austin"
  ],
  "countries": ["us", "uk"],
  "languageCode": "en",
  "brands": ["Brooks", "ASICS"],
  "domains": ["runrepeat.com"],
  "maxItems": 4
}
```

That run produces four records: both prompts in the United States and the United Kingdom.

### How it works

1. A real Chrome session warms up on Google, then opens the AI Mode tab (`udm=50`) for the prompt and market.
2. The actor waits for the answer to finish streaming, then reads the rendered answer and Google's embedded source/citation data.
3. Google `/goto` redirect links are resolved to the real publisher URL and duplicate sources are merged.
4. Brand and domain scores are computed against the final answer text and cited sources.
5. If Google serves a captcha, the browser session is rotated and the request is retried; a direct exit that returns no answer is escalated to the actor's datacenter proxy after one attempt, so a slow or experiment-bucketed exit cannot stall the run.
6. Each attempt has a hard time limit and the loop watches the Actor run timeout. Prompts that cannot finish in the remaining time are still returned as rows with `status: NO_ANSWER` and `errorCode: RUN_TIMEOUT` instead of the run being killed mid-item.

### Output example (trimmed)

```json
{
  "status": "OK",
  "prompt": "best running shoes for flat feet",
  "countryCode": "us",
  "languageCode": "en",
  "answerText": "Flat feet often cause the ankle to roll inward ...",
  "answerMarkdown": "Flat feet often cause the ankle to roll inward ...\\n\\n### Top Running Shoes ...",
  "sources": [
    {
      "position": 1,
      "title": "7 Best Running Shoes For Flat Feet in 2026",
      "siteName": "RunRepeat",
      "domain": "runrepeat.com",
      "url": "https://runrepeat.com/guides/best-flat-feet-running-shoes",
      "snippet": "The adidas Supernova Solution 3 is a solid recommendation ...",
      "citationGroups": [1]
    }
  ],
  "citationGroups": [
    {
      "position": 214,
      "label": "RunRepeat +5",
      "siteName": "RunRepeat",
      "additionalSourceCount": 5,
      "url": "https://runrepeat.com/guides/best-flat-feet-running-shoes",
      "sources": [{"position": 1, "title": "7 Best Running Shoes For Flat Feet in 2026"}]
    }
  ],
  "products": [
    {
      "position": 320,
      "name": "Brooks Adrenaline GTS 26",
      "price": "$154.95",
      "priceCurrency": "USD",
      "merchant": "Backcountry.com",
      "rating": 4.5,
      "reviewCount": 18,
      "bestFor": "Everyday training and long-distance comfort.",
      "supportTech": "GuideRails sidewalls keep excess foot movement in check.",
      "keySpecs": "10mm heel-to-toe drop, DNA LOFT v3 cushioning."
    }
  ],
  "brandVisibility": [
    {
      "name": "Brooks",
      "mentioned": true,
      "mentionCount": 4,
      "firstMentionPosition": 120,
      "citedAsSource": false
    }
  ],
  "grounded": true,
  "responseTimestamp": "2026-11-15T00:05:42Z"
}
```

### Notes and limitations

- AI Mode is generative. The same prompt can return a different answer, a different set of sources and a different number of cards from one run to the next. The actor records one snapshot per run.
- Not every answer shows sources, product cards, place cards or follow-up questions. Those fields are omitted rather than filled with placeholders; `grounded` tells you whether any source card was shown.
- Answers come from a logged-out visitor session. Google may still vary results by region, language, time and experiment bucket.
- Citation-chip positions are 1-based character offsets in `answerText`. When Google renders a citation as an icon without visible text (some place/map citations), the position is the start of the answer block that contains it.
- Google can change the AI Mode interface. The parser reads both the visible page and the embedded source data, keeps working when the answer heading, citation-chip class or card class changes, and returns records without an answer as `NO_ANSWER` instead of fabricating one.
- Each prompt gets a bounded number of network attempts (direct, then datacenter proxy only after a soft block or no answer). If the run's own timeout is too short for the remaining prompts, those rows are emitted immediately with `errorCode: RUN_TIMEOUT`; raise the run timeout or lower `maxItems`/prompt count to give every prompt a full streaming window.
- Some prompts, countries or languages do not get an AI Mode answer. Those rows keep the prompt and market, set `status: NO_ANSWER`, and are never charged as answers by your own pricing rules.

### FAQ

**Do I need a proxy or a Google account?**
No. The actor uses its own browser session and picks a network path automatically. There is nothing to configure.

**What is the difference between AI Mode and AI Overview?**
AI Overview is the short summary on a normal results page. AI Mode is the dedicated conversational tab (`udm=50`) with a longer answer, its own citation set, product/place cards and follow-up prompts.

**Can I run the same prompt in several countries?**
Yes. Add several countries to the Countries input; each prompt is asked once per country and produces one record per market.

**Why does a record have no sources?**
For some questions Google writes a complete answer without displaying source cards. The actor reports `grounded: false` and leaves the source fields out. It never invents sources.

**Why are prices missing on some product cards?**
Only the fields Google shows are returned. A card without a visible price simply omits `price` and `priceCurrency`.

**Can I schedule it?**
Yes. Use the same input on a schedule to track how answers and cited sources change over time.

# Actor input Schema

## `prompts` (type: `array`):

Questions or search prompts to ask Google AI Mode. Each prompt is asked once per selected country.

## `countries` (type: `array`):

Countries whose Google market (gl) the answers should reflect. Select one or more; each prompt is asked once per country.

## `languageCode` (type: `string`):

Language of the Google interface and of the AI Mode answer (hl). Pick the language your prompts are written in.

## `brands` (type: `array`):

Optional brand names. For each one the actor reports whether the AI Mode answer mentions it, how many times, where it first appears and whether it is cited as a source.

## `domains` (type: `array`):

Optional website domains (for example example.com). For each one the actor reports whether the answer mentions it and whether it appears among the cited sources.

## `includeProductCards` (type: `boolean`):

Extract the product cards Google shows inside the answer (name, price, merchant, rating, review count and key specs).

## `includePlaceCards` (type: `boolean`):

Extract local place cards when Google shows them in the answer.

## `includeFollowUpQuestions` (type: `boolean`):

Extract the follow-up questions Google suggests below the answer.

## `includeMarkdown` (type: `boolean`):

Also save the answer as markdown, keeping headings, lists, tables and inline citation markers.

## `maxItems` (type: `integer`):

Stop after this many answers. Each prompt and country pair produces one answer.

## Actor input object example

```json
{
  "prompts": [
    "best running shoes for flat feet"
  ],
  "countries": [
    "us"
  ],
  "languageCode": "en",
  "brands": [],
  "domains": [],
  "includeProductCards": true,
  "includePlaceCards": true,
  "includeFollowUpQuestions": true,
  "includeMarkdown": true,
  "maxItems": 1
}
```

# Actor output Schema

## `answers` (type: `string`):

Dataset containing one AI Mode answer per prompt and country.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "prompts": [
        "best running shoes for flat feet"
    ],
    "countries": [
        "us"
    ],
    "languageCode": "en",
    "brands": [],
    "domains": [],
    "includeProductCards": true,
    "includePlaceCards": true,
    "includeFollowUpQuestions": true,
    "includeMarkdown": true,
    "maxItems": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("xyrelith-data/google-ai-mode-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "prompts": ["best running shoes for flat feet"],
    "countries": ["us"],
    "languageCode": "en",
    "brands": [],
    "domains": [],
    "includeProductCards": True,
    "includePlaceCards": True,
    "includeFollowUpQuestions": True,
    "includeMarkdown": True,
    "maxItems": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("xyrelith-data/google-ai-mode-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "prompts": [
    "best running shoes for flat feet"
  ],
  "countries": [
    "us"
  ],
  "languageCode": "en",
  "brands": [],
  "domains": [],
  "includeProductCards": true,
  "includePlaceCards": true,
  "includeFollowUpQuestions": true,
  "includeMarkdown": true,
  "maxItems": 1
}' |
apify call xyrelith-data/google-ai-mode-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,xyrelith-data/google-ai-mode-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/W4DPN9n35ZDlXJCcB/builds/YPyW5y9bdygWtaIz2/openapi.json
