# Google Search Scraper (`api-ninja/google-search-scraper`) Actor

Extract structured Google results across Search, Images, Videos, Places, Maps, News, Shopping, Scholar, Autocomplete, and Patents. Supports query/category batching, localization, pagination, retries, and clean dataset output.

- **URL**: https://apify.com/api-ninja/google-search-scraper.md
- **Developed by:** [API ninja](https://apify.com/api-ninja) (community)
- **Categories:** Developer tools, Automation, SEO tools
- **Stats:** 361 total users, 80 monthly users, 99.9% runs succeeded, 15 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $2.00 / 1,000 results

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

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

### What does Google Search Scraper do?

Google Search Scraper lets you **scrape Google search results and other Google data** into a structured dataset on Apify. It supports **Search**, **Images**, **Videos**, **Places**, **Maps**, **News**, **Shopping**, **Scholar**, **Autocomplete**, and **Patents**, and works as a **Google Search API alternative** for extracting public Google data.

You provide `query`, `categories`, localization settings (`geo`, `lang`, `location`), and result limits, then the Actor handles pagination, retries, and dataset delivery. It extracts structured data from [Google](https://www.google.com) pages and endpoints through one workflow.

This Actor works for both **no-code users** (run in Apify UI and download CSV/Excel) and **developers** (use Apify API/SDK in Node.js or Python).

### Why use this Google Search Scraper?

- SEO monitoring and **Google SERP tracking** across organic, images, videos, and news
- Lead generation from **Google Maps / Places** business discovery
- Market and content research from **Google News, Scholar, and web results**
- Competitive analysis and catalog monitoring from **Google Shopping** data

### What can this Actor do?

- 🔍 Run one query per run (for example: `"coffee"`)
- 🗂️ Fetch multiple categories for one query in one workflow
- 🌍 Localize results with country/language parameters
- ♻️ Automatically retry failed requests (up to 3 times)
- 📄 Paginate until result target is met (or all available results if enabled)
- 📦 Push normalized output records into Apify dataset
- ⏱️ Use scheduling, API access, webhooks, and integrations through Apify platform

### Run it on the Apify platform

On Apify, you can:

- Schedule Google Search Scraper runs automatically (daily/weekly/custom)
- Access extracted Google SERP data through API and Apify SDKs
- Export datasets as JSON, CSV, Excel, or XML
- Connect runs to Make, Zapier, webhooks, and other integrations

### What Google search results and data can this scraper extract?

The Actor stores category results as raw result objects with metadata (`query`, `category`, `page`).

| Field | Type | Description |
| --- | --- | --- |
| `query` | string | Original query provided by user |
| `category` | string | Data source category (search, images, maps, etc.) |
| `page` | number | Page number used for this batch |
| `raw` | object | Full raw item returned by the category endpoint |

Typical `raw` data includes titles, links, snippets, thumbnails, source metadata, ranking positions, and category-specific fields.

### How to scrape Google data with this Actor

1. Open the Actor in Apify Store and go to the **Input** tab.
2. Add `query`.
3. Select one or more `categories`.
4. Set localization (`lang`, `geo`, optional `location`).
5. Choose either:
   - `resultsPerCategory` for capped scraping, or
   - `parseAllResults=true` to collect all available pages.
6. Run the Actor.
7. Download output from the dataset as JSON, CSV, Excel, XML, or via API.

For a step-by-step Google SERP scraping tutorial with Apify, see:
https://blog.apify.com/unofficial-google-search-api-from-apify-22a20537a951/

### Pricing and usage expectations

Cost depends on:

- Number of runs (one query per run)
- Number of selected categories
- Pagination depth per category
- Retry frequency caused by transient errors

For lower cost, start with a focused query and a limited `resultsPerCategory`. For maximum coverage, enable `parseAllResults`, which may increase run time and compute usage. Apify provides full run logs, usage tracking, and scheduling so you can control and optimize spend over time.

### Input example

```json
{
  "query": "Coffee",
  "categories": ["search", "places", "maps", "news"],
  "resultsPerCategory": 100,
  "parseAllResults": false,
  "autocorrect": true,
  "timeFrame": "qdr:w",
  "lang": "en",
  "geo": "US",
  "location": "New York, New York, United States",
  "ll": "@40.7128,-74.0060,11z",
  "placeId": "",
  "cid": ""
}
```

### Output

Google Search Scraper saves results into an Apify dataset. You can download the dataset in **JSON, CSV, Excel, or XML**, or read it programmatically via Apify API.

### Output example

```json
[
  {
    "query": "Coffee",
    "category": "search",
    "page": 1,
    "raw": {
      "title": "Coffee - Wikipedia",
      "link": "https://en.wikipedia.org/wiki/Coffee",
      "snippet": "Coffee is a beverage..."
    }
  },
  {
    "query": "Coffee",
    "category": "news",
    "page": 1,
    "raw": {
      "title": "Coffee prices rise globally",
      "source": "Example News",
      "link": "https://example.com/article"
    }
  }
]
```

### Related Google Actors

If you also work with local business intelligence, use these related tools:

- [Google Maps Scraper](https://apify.com/api-ninja/google-maps-scraper)
- [Google Maps Reviews Scraper](https://apify.com/api-ninja/google-maps-reviews-scraper)

### FAQ

#### Is this Actor good for no-code users?

Yes. Most users can run it with only query + categories + localization settings. Advanced map parameters (`ll`, `placeId`, `cid`) are optional.

#### How does pagination work?

If `parseAllResults=false`, pagination stops after `resultsPerCategory` items (or earlier if no more results exist). If `parseAllResults=true`, pagination continues until the endpoint returns an empty result list.

#### Is this suitable for production pipelines?

Yes. The Actor includes retries, structured logs, and predictable output format, and it can be scheduled or triggered via API/webhooks.

#### Is scraping legal?

Our scrapers are intended to collect **publicly available data** only. Results may still contain personal data, which can be regulated (for example by GDPR and similar laws). Do not scrape or use personal data without a legitimate reason, and always review the target website terms plus applicable laws in your jurisdiction.

### Support

- Check run logs first (request params, retries, pagination stop reason are logged).
- If you need custom fields or workflow extensions, open an issue in the Actor repository or contact the maintainer through Apify Store profile.
- You can connect this Actor output to other services via Apify integrations and API.

# Actor input Schema

## `query` (type: `string`):

Search query to process. The Actor runs this query across selected categories.

## `categories` (type: `array`):

Select which types of content to scrape for the query. Multiple categories are supported.

## `resultsPerCategory` (type: `integer`):

Maximum number of results to collect per category. Ignored when 'Parse all results' is enabled. Max average results per category is about 300.

## `parseAllResults` (type: `boolean`):

When enabled, scrape all available content regardless of the maximum results limit.

## `autocorrect` (type: `boolean`):

Enable Google query autocorrection when supported by the selected category endpoint.

## `timeFrame` (type: `string`):

Date range for filtering results. Select a specific time period or leave empty for 'Anytime'. Date range is supported for Search, Images, Videos, News categories.

## `lang` (type: `string`):

Two-letter language code for localized results (e.g., en, es, fr).

## `geo` (type: `string`):

Two-letter country code used for localization (e.g., US, GB, IN).

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

Optional location hint for more specific local results, such as cities or neighborhoods.

## `ll` (type: `string`):

This parameter allows you to adjust the focus of your search area by specifying GPS coordinates in this format: @latitude,longitude,zoom.  For example:@40.6973709,-74.1444871,11z.  You can find a search area by going to Google Maps, dragging around the map to your desired location, and then looking at the URL to get the coordinates.  The zoom level, while optional, is recommended for higher precision. It ranges from 3z (completely zoomed out) to 21z (completely zoomed in).  Setting the search area with this parameter only applies to search queries with q, not when you look up by placeId or cid.  This parameter is optional by default but required for paginated searches (page > 1).

## `placeId` (type: `string`):

This parameter allows you to search by Place ID. A Google Place ID uniquely identifies a location on Google Maps. Place IDs are available for most places, including businesses, landmarks, parks, and intersections. It's possible for the same place to have multiple different place IDs, and these IDs may change over time.

## `cid` (type: `string`):

This parameter allows you to search by CID. A Google CID (Customer Identification) number is a unique identification number for a specific business listing on Google Maps.

## Actor input object example

```json
{
  "query": "Coffee",
  "categories": [
    "search"
  ],
  "resultsPerCategory": 100,
  "parseAllResults": false,
  "autocorrect": true,
  "lang": "en",
  "geo": "US"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "query": "Coffee"
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-ninja/google-search-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 = { "query": "Coffee" }

# Run the Actor and wait for it to finish
run = client.actor("api-ninja/google-search-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 '{
  "query": "Coffee"
}' |
apify call api-ninja/google-search-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/Ydn4maFhCW1LSS9Y7/builds/m7GAOzrrk7DeXxRvI/openapi.json
