Metadata-Version: 2.4
Name: google-trends-compare
Version: 0.1.0
Summary: Compare more than 5 keywords in Google Trends on one shared 0-100 scale. A pytrends alternative without 429 errors.
License-Expression: MIT
Project-URL: Homepage, https://github.com/sassrami/google-trends-compare
Project-URL: Hosted scraper, https://apify.com/granola2/google-trends-scraper
Keywords: google trends,pytrends,pytrends alternative,google trends api,keyword research,seo
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: apify-client>=3.5
Dynamic: license-file

# Compare more than 5 keywords in Google Trends (pytrends alternative)

Google Trends compares at most 5 keywords at a time, and every request rescales its own top value to 100. Split 12 keywords into batches of 5 and the numbers from different batches can't be compared. On top of that, pytrends is archived and Google answers scripts with HTTP 429.

**In Colab?** [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/sassrami/google-trends-compare/blob/main/google_trends_colab.ipynb) Colab is where pytrends fails most (Google Cloud IPs get 429 on the first request). The notebook runs the same comparison, shows a ranking and a chart, and downloads a CSV.

`google-trends-compare` gets interest over time for **any number of keywords on one shared 0-100 scale**, as a CSV or a Python dict. It calls a hosted Google Trends scraper on Apify, so there is no rate limiting, cookie handling or proxy setup on your side.

```bash
pip install google-trends-compare
export APIFY_TOKEN=...   # free account at https://apify.com (Settings > API & Integrations)
                         # Windows PowerShell: $env:APIFY_TOKEN = "..."
google-trends-compare sneakers "running shoes" "trail running shoes" "barefoot shoes" \
  "wide toe box shoes" "minimalist shoes" "walking shoes" "hiking boots" "waterproof shoes" \
  "cross training shoes" "carbon plate running shoes" "zero drop shoes" --geo US
```

Output (`trends.csv`, real data, US, last 12 months):

| date | sneakers | hiking boots | walking shoes | barefoot shoes | zero drop shoes |
| --- | ---: | ---: | ---: | ---: | ---: |
| 2025-11-02 | 24 | 1.78 | 2.3 | 0.92 | 0.21 |
| 2025-11-09 | 25 | 1.88 | 2.3 | 0.92 | 0.21 |
| 2025-11-16 | 28 | 2.3 | 2.3 | 0.92 | 0.21 |

All columns share one scale: averaged over the year, "sneakers" (35.4) is about 160 times "zero drop shoes" (0.22). Fetched in separate batches of 5, those two numbers would come from different scales and could not be compared.

Options: `--geo` (country code, empty = worldwide), `--time` (`today 5-y`, `now 7-d`, `2024-01-01 2024-12-31`, ...), `--out` (CSV path).

From Python (pandas is optional):

```python
import pandas as pd
from google_trends_compare import compare

df = pd.DataFrame(compare(["pickleball", "padel", "tennis", "squash", "badminton", "golf"], geo="US"))
```

`compare()` returns `{keyword: {date: value}}`, so `pd.DataFrame` gives one column per keyword and one row per date. Keywords with no data are left out.

## Cost

The scraper charges per result: one keyword's time series is one result, $0.005 or less. 50 keywords cost about $0.25. Keywords Google has no data for are not charged. Apify's free plan includes monthly credit that covers small runs.

## Why not pytrends?

pytrends was archived on GitHub in 2025. Google rate-limits Trends per IP, and datacenter and cloud IPs (Colab, AWS, CI) often get 429 on the first request. If you want to keep doing it yourself: a few seconds between requests, a fresh session after each 429, exponential backoff, and residential IPs for volume.

## Disclosure

I built and maintain the scraper this calls: [granola2/google-trends-scraper](https://apify.com/granola2/google-trends-scraper). It also returns related queries, interest by region and trending searches. This script is MIT licensed.
