# Google Search Scraper — Google Custom Search API Alternative (`nexgendata/google-cse-replacement`) Actor

Google search scraper and Google Custom Search API alternative — a drop-in replacement for the CSE JSON API's "Search entire web" mode (killed Jan 1, 2027). Queries Google SERP directly and returns CSE-compatible JSON: titles, links, snippets, ranks.

- **URL**: https://apify.com/nexgendata/google-cse-replacement.md
- **Developed by:** [NexGenData](https://apify.com/nexgendata) (community)
- **Categories:** SEO tools, Marketing, Developer tools
- **Features:** Limited permissions
- **Stats:** 22 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$20.00 / 1,000 web search query (cse-compatible)s

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Search Scraper — Google Custom Search API Alternative

Google Search Scraper is a NexGenData tool on Apify that returns organic results with title, link, snippet and rank from Google search results pages.

A **Google search scraper** built as a **Google Custom Search API alternative**: same CSE-style JSON, results straight from the Google SERP.

SERP Results & Web Search API

**CSE replacement:** a Google Custom Search Engine substitute for programmatic SERP.

### 📊 Sample Output

![2 real rows delivered by Google Search Scraper — SERP Results & Web Search API — run cpC5JFmJZOxXmIxw4 on build 0.0.42](https://api.apify.com/v2/key-value-stores/8gLgXMBveEI1tTz1z/records/google-cse-replacement-sample)

| `kind` | `url` | `queries` | `context` | `searchInformation` | `items` |
|---|---|---|---|---|---|
| customsearch#search | {'type': 'application/json', 'template': 'https://www.googleapis.com/… | {'request': \[{'title': 'Google Search', 'totalResults': '0', 'searchT… | {'title': 'NexGenData CSE Replacement'} | {'searchTime': 52.052, 'formattedSearchTime': '52.05', 'totalResults'… | \[] |
| customsearch#search | {'type': 'application/json', 'template': 'https://www.googleapis.com/… | {'request': \[{'title': 'Google Search', 'totalResults': '1', 'searchT… | {'title': 'NexGenData CSE Replacement'} | {'searchTime': 6.16, 'formattedSearchTime': '6.16', 'totalResults': '… | \[{'kind': 'customsearch#result', 'title': 'Custom Search JSON API | G… |

Real rows from run `cpC5JFmJZOxXmIxw4` on build 0.0.42 (2026-09-25), unedited apart from masked emails/phones and shortened long text; fields the source does not publish are empty.

### ⚙️ Sample inputs

This is the Store example input — the same input Apify's automated check runs — so it is proven to return rows on the current build. Paste it into the input form, or send it through the API, CLI or a schedule:

```json
{
  "queries": [
    "apify scraper",
    "google custom search alternative"
  ],
  "num": 10,
  "start": 1,
  "gl": "us",
  "hl": "en",
  "safe": "off"
}
```

### 🔧 Input reference

| Field | Type | Default | What it does |
|---|---|---|---|
| `queries` (required) | array | `["apify scraper", "google custom search alternative"]` | One or more web-search queries. Each query is run independently and returns a CSE-compatible JSON object (one dataset record per query). |
| `num` | integer | `10` | Number of results to return per query. Mirrors the CSE `num` parameter. Max 100 (matches CSE max). |
| `start` | integer | `1` | 1-based start index of the first result. Use `start=11, num=10` to get page 2, etc. Mirrors the CSE `start` parameter. |
| `gl` | string | `"us"` | Two-letter country code biasing results toward that region. Mirrors CSE `gl`. Examples: us, gb, de, fr, ca, au, jp, br, in. |
| `hl` | string | `"en"` | Two-letter language code for the Google UI and results. Mirrors CSE `hl`. Examples: en, es, fr, de, ja, pt. |
| `safe` | string (off, medium, high) | `"off"` | Safe search level. `off` = no filtering, `medium` = moderate, `high` = strict (adult content filtered). |
| `site` | string | `""` | Restrict results to a single domain, e.g. `github.com`. Equivalent to appending `site:` to the query. Mirrors CSE `siteSearch`. |

### 🧾 JSON sample record

One real record from run `cpC5JFmJZOxXmIxw4` (emails/phones masked, long text shortened):

```json
{
  "kind": "customsearch#search",
  "url": {
    "type": "application/json",
    "template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&gl={gl?}&hl={hl?}&safe={safe?}"
  },
  "queries": {
    "request": [
      {
        "title": "Google Search",
        "totalResults": "0",
        "searchTerms": "apify scraper",
        "count": 0,
        "startIndex": 1,
        "inputEncoding": "utf8",
        "outputEncoding": "utf8",
        "safe": "off",
        "cx": "nexgendata-cse-replacement",
        "gl": "us",
        "hl": "en"
      }
    ]
  },
  "context": {
    "title": "NexGenData CSE Replacement"
  },
  "searchInformation": {
    "searchTime": 52.052,
    "formattedSearchTime": "52.05",
    "totalResults": "0",
    "formattedTotalResults": "0"
  },
  "items": []
}
```

### 💰 Pricing

| Event | Price (USD) | When it is charged |
|---|---|---|
| Web search query (CSE-compatible) (`search-query`) | $0.02 | One Google SERP fetch + parse + CSE-envelope response. $0.02 per query ($20 per 1,000); Google's retired Custom Search JSON API charged $5 per 1,000. |

Pay-per-event: you pay only for what the run delivers. A run that delivers nothing bills no result events (only the actor-start event, when the actor defines one). Example: a run that delivers 100 results costs 100 × $0.02 = $2.00 plus the start fee.

### 🔗 Related Actors

More from the NexGenData **Data APIs** family:

- [China A-Share Screener — 中国股票 Eastmoney API](https://apify.com/nexgendata/eastmoney-china-stock-screener?fpr=2ayu9b)
- [FINMA + MAS + SFC Enforcement Records API](https://apify.com/nexgendata/finma-mas-sfc-enforcement-tracker?fpr=2ayu9b)
- [Google Ads Transparency Competitor Ad Intelligence](https://apify.com/nexgendata/google-ads-transparency-intelligence?fpr=2ayu9b)
- [Lighthouse Bulk Checker — Performance at Scale](https://apify.com/nexgendata/google-lighthouse-checker?fpr=2ayu9b)
- [Google SERP Scraper — Rankings & Keywords](https://apify.com/nexgendata/google-search-scraper?fpr=2ayu9b)
- [Google Shopping Scraper — Product Prices & Sellers API](https://apify.com/nexgendata/google-shopping-scraper?fpr=2ayu9b)

27 more in this family on the [NexGenData Store page](https://apify.com/nexgendata?fpr=2ayu9b).

### 📊 What you get

Clean JSON output (6 fields):

- `query` — Query
- `position` — Position
- `title` — Title
- `url` — Url
- `snippet` — Snippet
- `source` — Source

**Pricing:** $0.020 per result (Pay-Per-Event) — about **50 results per $1**.

### 🤖 Use with AI agents

Point Claude, the OpenAI Agents SDK, an n8n flow or any MCP-aware client at it.

**Sample agent prompt:**

```
Search Google for 'best crm for startups' and return the top 10 results with titles and URLs.
```

**Agentic payments (x402):** Supports agentic payment via x402 — call this actor with USDC, no API key required.

### 🔗 Related tools — Search & SERP tools

[Google SERP Scraper](https://apify.com/nexgendata/google-search-scraper) · [SERP Rank Tracker](https://apify.com/nexgendata/serp-rank-tracker-lite)

***

*A NexGenData utility actor.*

# Actor input Schema

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

Search queries for the Google search scraper (Google Custom Search API alternative). One or more web-search queries. Each query is run independently and returns a CSE-compatible JSON object (one dataset record per query).

## `num` (type: `integer`):

Number of results to return per query. Mirrors the CSE `num` parameter. Max 100 (matches CSE max).

## `start` (type: `integer`):

1-based start index of the first result. Use `start=11, num=10` to get page 2, etc. Mirrors the CSE `start` parameter.

## `gl` (type: `string`):

Two-letter country code biasing results toward that region. Mirrors CSE `gl`. Examples: us, gb, de, fr, ca, au, jp, br, in.

## `hl` (type: `string`):

Two-letter language code for the Google UI and results. Mirrors CSE `hl`. Examples: en, es, fr, de, ja, pt.

## `safe` (type: `string`):

Safe search level. `off` = no filtering, `medium` = moderate, `high` = strict (adult content filtered).

## `site` (type: `string`):

Restrict results to a single domain, e.g. `github.com`. Equivalent to appending `site:<site>` to the query. Mirrors CSE `siteSearch`.

## Actor input object example

```json
{
  "queries": [
    "apify scraper",
    "google custom search alternative"
  ],
  "num": 10,
  "start": 1,
  "gl": "us",
  "hl": "en",
  "safe": "off",
  "site": ""
}
```

# Actor output Schema

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

Default dataset of Google Search Scraper — SERP Results & Web Search API records (6 fields per row: kind, url, queries, context, searchInformation, items).

# 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": [
        "apify scraper",
        "google custom search alternative"
    ],
    "num": 10,
    "start": 1,
    "gl": "us",
    "hl": "en",
    "safe": "off",
    "site": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("nexgendata/google-cse-replacement").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": [
        "apify scraper",
        "google custom search alternative",
    ],
    "num": 10,
    "start": 1,
    "gl": "us",
    "hl": "en",
    "safe": "off",
    "site": "",
}

# Run the Actor and wait for it to finish
run = client.actor("nexgendata/google-cse-replacement").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 '{
  "queries": [
    "apify scraper",
    "google custom search alternative"
  ],
  "num": 10,
  "start": 1,
  "gl": "us",
  "hl": "en",
  "safe": "off",
  "site": ""
}' |
apify call nexgendata/google-cse-replacement --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nexgendata/google-cse-replacement"
        }
    }
}
```

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/gXG2bboguRMvU6g4p/builds/dTg6rchPSGYvfsQUG/openapi.json
