# Google SERP Scraper (`crawlex/google-serp-scraper`) Actor

Scrape Google Search results as structured JSON — organic listings, ads, featured snippets, knowledge panels, People Also Ask, and related searches. Target any country or city, desktop or mobile. Fresh results on every run. Export to JSON, CSV, or Excel, or pull via API.

- **URL**: https://apify.com/crawlex/google-serp-scraper.md
- **Developed by:** [Crawlex](https://apify.com/crawlex) (community)
- **Categories:** Developer tools, SEO tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results pages

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Google SERP Scraper — Country-Targeted Search Results

Extract Google Search results as clean, structured JSON. Get the same results a
real user would see in any market — fresh on every run, not a stale cache or a
stripped-down API view.

Pull organic listings, ads, featured snippets, knowledge panels, "People also
ask", and related searches for any keyword, in any country, at scale.

### ⏩ Why use this scraper

- **Accurate local results.** Target any market by country or city — results
  reflect what searchers actually see in that location.
- **Complete SERP.** Captures the modern results layout, including AI Overviews
  and rich elements, exactly as ranked.
- **Structured output.** Each result is a separate dataset item with rank, URL,
  title, snippet, and result type — ready for analysis, no HTML parsing.
- **Built for scale.** Batch many queries and pages in a single run.
- **Simple per-page pricing.** Pay per results page — failed or empty queries are not charged.

### ✅ What you can extract

| Data | Included |
| --- | --- |
| Organic results (title, URL, displayed URL, snippet) | ✅ |
| Result rank & type | ✅ |
| Featured snippets / answer boxes | ✅ |
| Knowledge panel | ✅ |
| People Also Ask | ✅ |
| Related searches | ✅ |
| Sitelinks | ✅ |
| Country & language targeting | ✅ |
| Desktop & mobile layouts | ✅ |

### 🌍 Location targeting

Set `country` to an ISO country code (`US`, `GB`, `DE`, `TR`, …) to get results
for that market. For finer control, set `location` to a canonical place name
(e.g. `Berlin,Berlin,Germany` or `New York,New York,United States`) to localize
results to a specific city or region. Language and interface are controlled
independently with `locale` (e.g. `en-US`, `de-DE`).

### 🛠️ How to use

1. Click **Try for free** (or add the Actor to your account).
2. Enter one or more search queries.
3. Choose a country, language, and how many pages per query.
4. Run the Actor and download results as JSON, CSV, or Excel — or pull them via
   the API.

### 📥 Input

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `queries` | string[] | _required_ | One or more search queries. |
| `country` | string | `US` | ISO 3166-1 alpha-2 country code for result targeting. |
| `location` | string | _empty_ | Optional canonical location (city/region) for precise geo-targeting. |
| `locale` | string | `en-US` | BCP-47 language/region for the interface and result language. |
| `device` | enum | `desktop` | `desktop` or `mobile` SERP layout. |
| `pages` | integer | `1` | Pages to fetch per query. |
| `safe` | boolean | `true` | SafeSearch on/off. |
| `time_range` | enum | `any` | Restrict to `day` / `week` / `month` / `year`. |
| `site_restrict` | string | _empty_ | Limit to one domain, e.g. `wikipedia.org`. |

#### Example input

```json
{
  "queries": ["best running shoes", "wireless earbuds"],
  "country": "GB",
  "locale": "en-GB",
  "pages": 1
}
````

### 📤 Output

Each organic result is one dataset item:

```json
{
  "rank": 1,
  "type": "organic",
  "title": "The 12 Best Running Shoes of 2026",
  "url": "https://www.example.com/best-running-shoes",
  "displayed_url": "example.com › running › best",
  "snippet": "We tested 40 pairs over six months to find the best running shoes for every runner and budget.",
  "sitelinks": [],
  "rich_attributes": {},
  "_query": "best running shoes",
  "_page": 1
}
```

Results export to JSON, CSV, Excel, or HTML, and are available through the Apify
API and dataset endpoints.

### 💸 Pricing

Every account gets a **monthly free allowance** to try the Actor at no cost.
Beyond that, it's **pay-per-page** — you're charged once per results page
returned (one page = one page of Google results for a query). Queries that fail
or return no results are not charged. See the **Pricing** tab for the current
free allowance and per-page rate.

### 💡 Use cases

- **SEO & rank tracking** — monitor keyword positions across countries.
- **Competitor research** — see who ranks for your target terms in each market.
- **Market & content research** — gather titles, snippets, and PAA questions.
- **Brand & SERP monitoring** — track how your domain appears over time.
- **Lead & data enrichment** — collect domains and metadata at scale.

### ❓ FAQ

**Can I get results for a specific country or city?**
Yes. Use `country` for national targeting and `location` for a specific city or
region, and the results reflect that market.

**Are the results live or cached?**
Live — results are fetched fresh for every run.

**Why do some queries return fewer results than `num`?**
Google decides the final layout. Highly localized, navigational, or low-volume
queries can return fewer organic listings or more rich elements (maps, ads,
knowledge panels) in place of standard results.

**Can I scrape many keywords at once?**
Yes. Add as many queries as you like and set `pages` per query. For very large
jobs, split them across multiple runs.

**What formats can I export?**
JSON, CSV, Excel, and HTML, plus full access via the Apify API.

### ⚠️ Responsible use

Use this Actor in compliance with applicable laws and the terms of the sites you
access. Scrape publicly available data only, and do not collect personal data
without a lawful basis.

# Actor input Schema

## `queries` (type: `array`):

One or more Google search queries to scrape. Each returns organic results, ads, featured snippets, knowledge panel, related searches, and People Also Ask.

## `country` (type: `string`):

ISO 3166-1 alpha-2 country code (US, GB, TR, DE, ...). Returns results as they appear to searchers in that country.

## `location` (type: `string`):

Pin results to a specific place, e.g. 'Germany' or 'Berlin,Berlin,Germany'. Takes precedence over Country. Leave blank to target by country only.

## `locale` (type: `string`):

Language and region of the results, as a BCP-47 locale (en-US, tr-TR, de-DE, ...).

## `device` (type: `string`):

Return desktop or mobile search results.

## `pages` (type: `integer`):

How many pages to fetch per query. 1 = just the first page. Set higher for deep scraping.

## `safe` (type: `boolean`):

Google SafeSearch filter. Off returns adult content where applicable.

## `time_range` (type: `string`):

Restrict to results from the last day / week / month / year. 'any' = no filter.

## `site_restrict` (type: `string`):

Limit to a single domain (e.g. 'wikipedia.org'). Equivalent to the site: operator.

## Actor input object example

```json
{
  "queries": [
    "best wireless headphones 2026",
    "site:reddit.com macbook m4"
  ],
  "country": "US",
  "location": "",
  "locale": "en-US",
  "device": "desktop",
  "pages": 1,
  "safe": true,
  "time_range": "any",
  "site_restrict": ""
}
```

# 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 = {
    "queries": [
        "best wireless headphones 2026",
        "site:reddit.com macbook m4"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlex/google-serp-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 = { "queries": [
        "best wireless headphones 2026",
        "site:reddit.com macbook m4",
    ] }

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

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

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

```

## CLI example

```bash
echo '{
  "queries": [
    "best wireless headphones 2026",
    "site:reddit.com macbook m4"
  ]
}' |
apify call crawlex/google-serp-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crawlex/google-serp-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Google SERP Scraper",
        "description": "Scrape Google Search results as structured JSON — organic listings, ads, featured snippets, knowledge panels, People Also Ask, and related searches. Target any country or city, desktop or mobile. Fresh results on every run. Export to JSON, CSV, or Excel, or pull via API.",
        "version": "0.1",
        "x-build-id": "rtuiq8XCS6PgzQker"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crawlex~google-serp-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crawlex-google-serp-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/crawlex~google-serp-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crawlex-google-serp-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/crawlex~google-serp-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crawlex-google-serp-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "queries"
                ],
                "properties": {
                    "queries": {
                        "title": "Search queries",
                        "type": "array",
                        "description": "One or more Google search queries to scrape. Each returns organic results, ads, featured snippets, knowledge panel, related searches, and People Also Ask.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "country": {
                        "title": "Country",
                        "type": "string",
                        "description": "ISO 3166-1 alpha-2 country code (US, GB, TR, DE, ...). Returns results as they appear to searchers in that country.",
                        "default": "US"
                    },
                    "location": {
                        "title": "Location (optional)",
                        "type": "string",
                        "description": "Pin results to a specific place, e.g. 'Germany' or 'Berlin,Berlin,Germany'. Takes precedence over Country. Leave blank to target by country only.",
                        "default": ""
                    },
                    "locale": {
                        "title": "Locale",
                        "type": "string",
                        "description": "Language and region of the results, as a BCP-47 locale (en-US, tr-TR, de-DE, ...).",
                        "default": "en-US"
                    },
                    "device": {
                        "title": "Device",
                        "enum": [
                            "desktop",
                            "mobile"
                        ],
                        "type": "string",
                        "description": "Return desktop or mobile search results.",
                        "default": "desktop"
                    },
                    "pages": {
                        "title": "Pages per query",
                        "minimum": 1,
                        "maximum": 10,
                        "type": "integer",
                        "description": "How many pages to fetch per query. 1 = just the first page. Set higher for deep scraping.",
                        "default": 1
                    },
                    "safe": {
                        "title": "SafeSearch",
                        "type": "boolean",
                        "description": "Google SafeSearch filter. Off returns adult content where applicable.",
                        "default": true
                    },
                    "time_range": {
                        "title": "Time range",
                        "enum": [
                            "any",
                            "day",
                            "week",
                            "month",
                            "year"
                        ],
                        "type": "string",
                        "description": "Restrict to results from the last day / week / month / year. 'any' = no filter.",
                        "default": "any"
                    },
                    "site_restrict": {
                        "title": "Site restriction",
                        "type": "string",
                        "description": "Limit to a single domain (e.g. 'wikipedia.org'). Equivalent to the site: operator.",
                        "default": ""
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
