# Google Trends API & Scraper — Pytrends Alternative (`galih_rakasiwi/google-trends-api`) Actor

Fast, reliable Google Trends data as clean LLM-ready JSON: interest over time, interest by region, related queries/topics, and daily trending. HTTP-only, no browser — ~10x faster than browser scrapers. Bulk rescaling and plain-English summaries.

- **URL**: https://apify.com/galih_rakasiwi/google-trends-api.md
- **Developed by:** [RD.Galih Rakasiwi](https://apify.com/galih_rakasiwi) (community)
- **Categories:** SEO tools, Developer tools, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.80 / 1,000 trend 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/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 Trends Scraper & API

Fast, reliable Google Trends data as clean, LLM-ready JSON — no browser, no pytrends.

### Why this actor

The official `apify/google-trends-scraper` has a ~37% failure rate and can take
up to 180s per request because it drives a headless browser. This actor talks
directly to Google Trends' internal JSON endpoints over plain HTTP, giving:

- **~10× faster** responses (a 2-keyword query returns in well under a second).
- **~99% success** via cookie-session warm-up, rotating User-Agents, and
  exponential backoff on 429/5xx.
- **Comparable bulk scaling** — rescaled onto one 0–100 scale via an anchor term.
- **LLM-ready summaries** — momentum, seasonality, YoY and peak per keyword.

### Features

| Mode | Description |
|---|---|
| 🔎 `compare` | Up to 5 keywords side-by-side (single request). |
| 📦 `bulk` | Unlimited keywords rescaled against an anchor term → one comparable scale. |
| 🔥 `trending` | Google's daily trending searches (RSS feed). |

Data types: **interest over time**, **interest by region**, **related queries**,
**related topics**. Search properties: web, images, news, YouTube, shopping.

### Input

Key fields (see `.actor/input_schema.json` for the full schema):

- `mode` — `compare` | `bulk` | `trending`
- `keywords` — list of terms (max 5 in compare mode, up to 200 in bulk)
- `timeframe` — `today 12-m`, `now 7-d`, `today 5-y`, `2004-present`, custom, …
- `geo` — ISO country code (empty = worldwide)
- `category` — Google Trends category ID (0 = all)
- `property` — web / images / news / youtube / shopping
- `dataTypes` — which datasets to return
- `anchorKeyword` — reference term for bulk rescaling
- `proxy` — Apify proxy (residential recommended for large bulk runs)

### Output (dataset)

One record per keyword:

```json
{
  "keyword": "bitcoin",
  "geo": "",
  "timeframe": "today 12-m",
  "property": "web",
  "category": 0,
  "fetchedAt": "2026-10-09T12:00:00+00:00",
  "interestOverTime": [{"date": "2025-10-12", "value": 48}, {"date": "2025-10-19", "value": 52}],
  "interestByRegion": [{"geoCode": "US", "geoName": "United States", "value": 100}],
  "relatedQueries": {"top": [{"query": "bitcoin price", "value": 100}], "rising": [{"query": "bitcoin etf", "value": 4300}]},
  "summary": {"latest": 52, "average": 48.5, "peakValue": 100, "peakDate": "2026-04-05", "trend": "rising", "yoyChangePct": 12.4}
}
```

In `bulk` mode each record also carries `anchorKeyword` and
`interestOverTimeNormalized` (values comparable across all keywords).

### Local development

```bash
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
## Run the core client directly (no Apify credentials needed):
python test_local.py
## Or run the full actor:
apify run
```

### Notes

- Google Trends values are **relative 0–100 scores**, not absolute volumes.
- Google scales each request to its own maximum; use `bulk` mode with an anchor
  term if you need cross-keyword comparison.
- The `related queries` / `related topics` endpoints are blocked from datacenter
  IPs (Google classifies them as `USER_TYPE_SCRAPER`); use **residential proxy**
  to unlock them. The actor degrades gracefully — blocked endpoints are skipped
  with a warning instead of failing the run.
- Trending mode uses the `/trending/rss` feed (the old `dailytrends` /
  `realtimetrends` endpoints were retired by Google and now return 404).

### Related searches

google trends api, pytrends alternative, google trends scraper, keyword research api, trends data json, google trends without api key, interest over time api

# Actor input Schema

## `mode` (type: `string`):

Compare: up to 5 keywords in one request with all data types. Bulk: many keywords rescaled onto one comparable 0–100 scale via an anchor term. Trending: Google's daily + realtime trending searches.

## `keywords` (type: `array`):

Search terms. Compare mode: max 5. Bulk mode: unlimited (each is compared against the anchor term).

## `keyword` (type: `string`):

Alternative to the Keywords list — a single search term.

## `timeframe` (type: `string`):

Date range for the interest-over-time series. Custom ranges use the format 'YYYY-MM-DD YYYY-MM-DD'.

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

ISO-3166 country code (e.g. US, ID, GB, JP) or leave empty for worldwide.

## `category` (type: `integer`):

Google Trends category ID (0 = all categories, 1 = Arts & Entertainment, 7 = Finance, 71 = Food & Drink, 133 = Health, 184 = Jobs & Education, 410 = Internet & Telecom, 1186 = Shopping, …).

## `property` (type: `string`):

Which Google property to measure.

## `dataTypes` (type: `array`):

Which datasets to return per keyword. Interest over time is always included.

## `anchorKeyword` (type: `string`):

The reference term every other keyword is scaled against, so results share one comparable 0–100 scale. Defaults to the first keyword.

## `maxKeywords` (type: `integer`):

Upper bound on keywords processed in bulk mode.

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

Route requests through Apify proxy. RECOMMENDED — residential proxies greatly reduce 429 rate-limits for bulk runs.

## `requestTimeoutSecs` (type: `integer`):

Per-request timeout. Increase for slow proxy connections.

## `requestDelaySecs` (type: `number`):

Pause between requests to avoid burst rate-limiting. Lower with residential proxies; raise on datacenter IPs.

## `maxRetries` (type: `integer`):

Exponential-backoff retries per request on 429/5xx.

## Actor input object example

```json
{
  "mode": "compare",
  "keywords": [
    "bitcoin",
    "ethereum",
    "solana"
  ],
  "keyword": "artificial intelligence",
  "timeframe": "today 12-m",
  "category": 0,
  "property": "web",
  "dataTypes": [
    "interest_over_time",
    "interest_by_region",
    "related_queries",
    "related_topics"
  ],
  "maxKeywords": 50,
  "proxy": {
    "useApifyProxy": true
  },
  "requestTimeoutSecs": 30,
  "requestDelaySecs": 1,
  "maxRetries": 5
}
```

# Actor output Schema

## `dataset` (type: `string`):

All trend records as clean JSON/CSV.

## `runConsole` (type: `string`):

Logs, storage and metrics.

# 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 = {
    "keywords": [
        "bitcoin",
        "ethereum",
        "solana"
    ],
    "keyword": "artificial intelligence",
    "geo": "",
    "dataTypes": [
        "interest_over_time",
        "interest_by_region",
        "related_queries",
        "related_topics"
    ],
    "anchorKeyword": "",
    "proxy": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("galih_rakasiwi/google-trends-api").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 = {
    "keywords": [
        "bitcoin",
        "ethereum",
        "solana",
    ],
    "keyword": "artificial intelligence",
    "geo": "",
    "dataTypes": [
        "interest_over_time",
        "interest_by_region",
        "related_queries",
        "related_topics",
    ],
    "anchorKeyword": "",
    "proxy": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("galih_rakasiwi/google-trends-api").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 '{
  "keywords": [
    "bitcoin",
    "ethereum",
    "solana"
  ],
  "keyword": "artificial intelligence",
  "geo": "",
  "dataTypes": [
    "interest_over_time",
    "interest_by_region",
    "related_queries",
    "related_topics"
  ],
  "anchorKeyword": "",
  "proxy": {
    "useApifyProxy": true
  }
}' |
apify call galih_rakasiwi/google-trends-api --silent --output-dataset

```

## MCP server setup

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

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/5vcK1wsmxTWLNa67M/builds/OXgHrtb2gcRJEPF8a/openapi.json
