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

Boost SEO with our tool! Explore organic & paid results, People Also Ask, and Related Queries. Select countries, languages, and precise locations for tailored insights.

- **URL**: https://apify.com/epctex/google-search-scraper.md
- **Developed by:** [epctex](https://apify.com/epctex) (community)
- **Categories:** SEO tools, Lead generation
- **Stats:** 2,685 total users, 8 monthly users, 96.2% runs succeeded, 67 bookmarks
- **User rating**: 3.48 out of 5 stars

## Pricing

$20.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period. You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

## 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

## Actor - Google Search Scraper

### Google Search scraper

Since Google Search doesn't provide a good and free API, this actor should help you to retrieve data from it.

The Google Search data scraper supports the following features:

- Unlock Comprehensive Search Results - Gather every search result from Google, unfiltered and exhaustive.

- Maximize Your Data Collection - Collect an extensive range of search results, including both organic and paid listings, with precision and efficiency.

- Global Insights, Local Focus - Customize search results by country and language with ease, ensuring your data reflects the global and local perspectives you need.

- Precision Location-Based Insights - Gather results for a specific location - down to the street level. Refine your search intelligence and understand how information varies across geographies.

- Unleash the Power of "People Also Ask" - Discover related queries and expand your search intelligence, gaining deeper insights into user intent and content opportunities.

- Expand Insights with Related Queries - Unlock valuable search trends and user interests with our feature to retrieve "Related Queries." Gain a deeper understanding of search intent and uncover hidden opportunities for your business or research.

- Effortless Google Search Mastery - Harness the full potential of Google search, effortlessly retrieving the data you need to inform your strategies and decisions.

- Data in Your Preferred Format - Export results in XML, JSON, CSV, or Excel, your choice! Tailor your data output to match your analysis and reporting needs effortlessly.

### Bugs, fixes, updates, and changelog

This scraper is under active development. If you have any feature requests you can create an issue from [here](https://github.com/epctex-support/google-search-scraper/issues).

### Input Parameters

The input of this scraper should be JSON containing the list of pages on Google Search that should be visited. Required fields are:

- `startUrls`: (Optional) (Array) List of Google Search URLs. You should only include search URLs. It must be used if `queries` parameter is not used.

- `queries`: (Optional) (Array) Keywords you want to search on Google. It must be used if `startUrls` parameter is not used.

- `countryCode`: (Optional) (String) This option determines the Google search domain by the country code. It only applies to the search queries.

- `languageCode`: (Optional) (String) This option determines the language of the Google search results which is passed to Google Search as the `hl` URL query parameter.

- `locationUule`: (Optional) (String) The code for the exact location for the Google search. It's passed to Google Search as the uule URL query parameter. You can use the UULE code generator https://padavvan.github.io/.

- `maxItems`: (Optional) (Integer) You can limit scraped items. This should be useful when you search through the big lists or search results.

- `resultsPerPage`: (Optional) (String) Number of search results for each Google result page. By default, Google Search returns 10 results per page. The allowed values are 10, 20, 30, 40, 50 and 100.

- `includeUnfilteredResults`: (Optional) (Boolean) If checked, the lower-quality results that Google normally filters out will be included. This usually consists of a few hundred extra results.

- `includePeopleAlsoAsk`: (Optional) (Boolean) If checked, the 'People also ask' field will be included in the output.

- `csvFriendlyOutput`: (Optional) (Boolean) If enabled, each search result will be saved to a separate file instead of grouping them in batches. This is useful for managing and processing individual records separately.

- `endPage`: (Optional) (Integer) The page number that you want to end with. By default there is no end page. This is applies to all search requests and startUrls individually.

- `proxy`: (Required) (Proxy Object) Proxy configuration. This actor requires the **GOOGLE\_SERP** Apify Proxy group - other proxy groups (or no proxy) will get blocked by Google.

- `extendOutputFunction`: (Optional) (String) Function that takes a JQuery handle ($) as an argument and returns an object with data.

- `customMapFunction`: (Optional) (String) Function that takes each object's handle as an argument and returns the object with executing the function.

This solution requires the use of **Proxy servers**. Use [Apify Proxy](https://www.apify.com/docs/proxy) with the **GOOGLE\_SERP** proxy group selected. GOOGLE\_SERP is the Apify proxy group built to run Google search requests without getting blocked.

#### Tip

When you want to scrape over a specific list URL, just copy and paste the link as one of the **startUrl**.

If you would like to scrape only the first page of a list then put the link for the page and have the `endPage` as 1.

With the last approach that is explained above you can also fetch any interval of pages. If you provide the 5th page of a list and define the `endPage` parameter as 6 then you'll have the 5th and 6th pages only.

#### Compute Unit Consumption

The actor is optimized to run blazing fast and scrape as many items as possible. Therefore, it forefronts all the detailed requests. If the actor doesn't block very often it'll scrape 100 listings in 2 minutes with ~0.04-0.45 compute units.

#### Google Search Scraper Input example

```json
{
  "queries":[
    "sculpture"
  ],
  "endPage":2,
  "maxItems": 10,
  "startUrls":[
    "https://www.google.com/search?q=fitness"
  ],
  "countryCode": "us",
  "languageCode": "tr",
  "locationUule":"w+CAIQICIIaXN0YW5idWw=",
  "resultsPerPage":"20",
  "includeUnfilteredResults": true,
  "csvFriendlyOutput": false,
  "proxy":{
    "useApifyProxy":true,
    "apifyProxyGroups":["GOOGLE_SERP"]
  }
}

```

### During the Run

During the run, the actor will output messages letting you know what is going on. Each message always contains a short label specifying which page from the provided list is currently specified.
When items are loaded from the page, you should see a message about this event with a loaded item count and total item count for each page.

If you provide incorrect input to the actor, it will immediately stop with a failure state and output an explanation of what is wrong.

### Google Search Export

During the run, the actor stores results into a dataset. Each item is a separate item in the dataset.

You can manage the results in any language (Python, PHP, Node JS/NPM). See the FAQ or <a href="https://www.apify.com/docs/api" target="blank">our API reference</a> to learn more about getting results from this Google Search actor.

### Scraped Google Search Properties

The structure of each item in Google Search looks like this:

#### Item Detail

```json
{
	"url": "https://google.com/search?q=sculpture&gl=us&num=20&hl=tr&filter=0&uule=w%2BCAIQICIIaXN0YW5idWw%3D",
	"name": "sculpture - Google'da Ara",
	"paidResults": [
		{
			"title": "Steel Sculpture Manufacturer - Fabrication for World Sculptor",
			"url": "https://www.sinosculpture.com/case/stainless-steel-sculpture/LOVEME-MEXICO.html",
			"displayedUrl": "https://www.sinosculpture.com/",
			"description": "Steel Sculpture Manufacturer - Fabrication for World Sculptorsinosculpture.comsinosculpture.comProviding fabrication, 3D modeling, mirror polishing for contemporary art metal sculpture. Installed in USA, UK, Singapore, Italy, UAE, Thai etc. for world sculptor and architect.",
			"siteLinks": [
				{
					"title": "Custom for Sculptor",
					"url": "https://www.sinosculpture.com/video/intl_report/"
				},
				{
					"title": "3D Tech Assistance",
					"url": "https://www.sinosculpture.com/service/"
				},
				{
					"title": "Superb Mirrored Sculpture",
					"url": "https://www.sinosculpture.com/case/stainless-steel-sculpture/"
				},
				{
					"title": "Sky mirror polish",
					"url": "https://www.sinosculpture.com/video/latest_program/"
				}
			],
			"type": "paid"
		}
	],
	"organicResults": [
		{
			"title": "Sculpture - Tate",
			"url": "https://www.tate.org.uk/art/art-terms/s/sculpture#:~:text=Three%2Ddimensional%20art%20made%20by,carving%2C%20modelling%2C%20casting%2C%20constructing",
			"displayedUrl": "https://www.tate.org.uk › art › art-terms › sculpture",
			"description": "",
			"siteLinks": [],
			"type": "organic",
			"position": 1
		},
		{
			"title": "Sculpture - Tate",
			"url": "https://www.tate.org.uk/art/art-terms/s/sculpture#:~:text=Three%2Ddimensional%20art%20made%20by,carving%2C%20modelling%2C%20casting%2C%20constructing",
			"displayedUrl": "https://www.tate.org.uk › art › art-terms › sculpture",
			"description": "",
			"siteLinks": [],
			"type": "organic",
			"position": 2
		},
		{
			"title": "Sculpture",
			"url": "https://en.wikipedia.org/wiki/Sculpture",
			"displayedUrl": "https://en.wikipedia.org › wiki",
			"description": "Sculpture is the three-dimensional art work which is physically presented in the dimensions of height, width and depth. It is one of the plastic arts. Durable ...",
			"siteLinks": [
				{
					"title": "Bronze sculpture",
					"url": "https://en.wikipedia.org/wiki/Bronze_sculpture"
				},
				{
					"title": "Classical sculpture",
					"url": "https://en.wikipedia.org/wiki/Classical_sculpture"
				},
				{
					"title": "Architectural sculpture",
					"url": "https://en.wikipedia.org/wiki/Architectural_sculpture"
				},
				{
					"title": "Butter sculpture",
					"url": "https://en.wikipedia.org/wiki/Butter_sculpture"
				}
			],
			"type": "organic",
			"position": 3
		}
	],
	"relatedQueries": [
		{
			"title": "Sculpture Parfüm",
			"url": "https://www.google.com/search?q=Sculpture%20Parf%C3%BCm"
		},
		{
			"title": "Sculpture art",
			"url": "https://www.google.com/search?q=Sculpture%20art"
		}
	],
	"searchQuery": {
		"query": "sculpture",
		"countryCode": "us",
		"languageCode": "tr",
		"resultsPerPage": "20",
		"domain": "google.com",
		"locationUule": "w+CAIQICIIaXN0YW5idWw="
	}
}
```

### Contact

Please visit us through [epctex.com](https://epctex.com) to see all the products that are available for you. If you are looking for any custom integration or so, please reach out to us through the chat box in [epctex.com](https://epctex.com). In need of support? <business@epctex.com> is at your service.

# Actor input Schema

## `startUrls` (type: `array`):

URLs to start with. It should be a search URL

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

(Required if you don't use 'Start URLs') You can provide a list of queries that you want to search.

## `csvFriendlyOutput` (type: `boolean`):

If enabled, each search result will be outputted to a separate file instead of in batches.

## `countryCode` (type: `string`):

Country determines the Google Search domain (e.g. <code>google.es</code> for Spain). <br><br>This setting only applies to Search queries.

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

Language for the search results, which is passed to Google Search as the hl URL query parameter. (af, tr, de, etc...)

## `locationUule` (type: `string`):

The code for the exact location for the Google search. It's passed to Google Search as the uule URL query parameter. You can use the UULE code generator https://padavvan.github.io/

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

Maximum number of items that you want as output. Default is all

## `resultsPerPage` (type: `string`):

Number of search results for each Google result page. By default, Google Search returns 10 results per page. The allowed values are 10, 20, 30, 40, 50 and 100.

## `includeUnfilteredResults` (type: `boolean`):

If checked, the lower-quality results that Google normally filters out will be included. This usually consists of a few hundred extra results.

## `includePeopleAlsoAsk` (type: `boolean`):

If checked, the 'People also ask' field will be included in the output.

## `endPage` (type: `integer`):

The page number that you want to end with. By default there is no end page. This is applies to all search request and startUrls individually.

## `extendOutputFunction` (type: `string`):

Function that takes a JQuery handle ($) as argument and returns data that will be merged with the default output

## `customMapFunction` (type: `string`):

Function that takes each of the objects as argument and returns data that will be mapped by the function itself.

## `proxy` (type: `object`):

Select proxies to be used by your crawler. This actor requires the GOOGLE\_SERP proxy group - with any other group Google answers with an interstitial page instead of search results and the run fails.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.google.com/search?q=fitness"
  ],
  "queries": [
    "sculpture"
  ],
  "csvFriendlyOutput": false,
  "countryCode": "us",
  "languageCode": "en",
  "locationUule": "w+CAIQICIIaXN0YW5idWw=",
  "maxItems": 20,
  "resultsPerPage": "10",
  "includeUnfilteredResults": false,
  "includePeopleAlsoAsk": true,
  "endPage": 1,
  "extendOutputFunction": "($) => { return {} }",
  "customMapFunction": "(object) => { return {...object} }",
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "GOOGLE_SERP"
    ]
  }
}
```

# 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 = {
    "startUrls": [
        "https://www.google.com/search?q=fitness"
    ],
    "queries": [
        "sculpture"
    ],
    "locationUule": "w+CAIQICIIaXN0YW5idWw=",
    "maxItems": 20,
    "endPage": 1,
    "extendOutputFunction": ($) => { return {} },
    "customMapFunction": (object) => { return {...object} },
    "proxy": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "GOOGLE_SERP"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("epctex/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 = {
    "startUrls": ["https://www.google.com/search?q=fitness"],
    "queries": ["sculpture"],
    "locationUule": "w+CAIQICIIaXN0YW5idWw=",
    "maxItems": 20,
    "endPage": 1,
    "extendOutputFunction": "($) => { return {} }",
    "customMapFunction": "(object) => { return {...object} }",
    "proxy": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["GOOGLE_SERP"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("epctex/google-search-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 '{
  "startUrls": [
    "https://www.google.com/search?q=fitness"
  ],
  "queries": [
    "sculpture"
  ],
  "locationUule": "w+CAIQICIIaXN0YW5idWw=",
  "maxItems": 20,
  "endPage": 1,
  "extendOutputFunction": "($) => { return {} }",
  "customMapFunction": "(object) => { return {...object} }",
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "GOOGLE_SERP"
    ]
  }
}' |
apify call epctex/google-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,epctex/google-search-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/V8SFJw3gKgULelpok/builds/HxfEDDgq9PjBIJVmn/openapi.json
