pytrends was archived in April 2025. If you still depend on it, you've probably met this:
pytrends.exceptions.TooManyRequestsError: The request failed: Google returned a response with code 429
pytrends loads the Google Trends website like a browser, and Google rate-limits that traffic. Sleeping, rotating proxies and retrying helps a bit — until it doesn't. And Google's official Trends API is still an application-only alpha (announced July 2025, no release date yet).
Here's how I get the same data (interest over time, related queries, interest by region) reliably in a few lines of Python.
1. Setup
pip install "apify-client>=3" pandas
export APIFY_TOKEN=... # free account at console.apify.com
I'm using the Google Trends Scraper & API on Apify (disclosure: I built it). It gets the data from commercial Google Trends data providers, so you never hit Google from your own IP or fight 429s yourself, and failed lookups aren't charged.
2. Interest over time → pandas (the interest_over_time() replacement)
import os
import pandas as pd
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("jesting_grass/google-trends-api").call(run_input={
"keywords": ["bitcoin", "ethereum"], # up to 5 compared in one query
"timeRange": "past_5_years",
})
series = [
pd.Series({p["date"]: p["value"] for p in row["timeline"]}, name=row["keyword"])
for row in client.dataset(run.default_dataset_id).iterate_items()
]
df = pd.concat(series, axis=1)
df.index = pd.to_datetime(df.index)
print(df.tail())
bitcoin ethereum
2026-08-23 26 3
2026-08-30 23 2
2026-09-06 19 2
2026-09-13 19 2
2026-09-20 22 3
Each row also comes with averageInterest, peakInterest, peakDate and latestInterest, so you often don't need pandas at all.
3. Related queries — the keyword-research goldmine
"Rising" and Breakout related queries are where new keyword ideas come from. Flip one switch:
run = client.actor("jesting_grass/google-trends-api").call(run_input={
"keywords": ["protein powder"],
"location": "United States",
"searchType": "youtube", # web | youtube | news | images | froogle
"includeRelatedQueries": True,
"includeInterestByRegion": True,
})
for row in client.dataset(run.default_dataset_id).iterate_items():
for q in row["relatedQueries"]["rising"][:5]:
print(f'{q["query"]:<35} {q["value"]}')
lead in protein powder +550%
protein powder scam +350%
flavorless protein powder +200%
costco protein powder +170%
orgain protein powder +160%
That's YouTube search trends — handy if you make videos. Same for News, Images and Google Shopping.
4. pytrends → API cheat sheet
| pytrends | API input / output |
|---|---|
build_payload(kw, timeframe='today 12-m', geo='US') |
keywords, timeRange: "past_12_months", location: "United States"
|
interest_over_time() |
row["timeline"] |
related_queries() |
includeRelatedQueries: true |
related_topics() |
includeRelatedTopics: true |
interest_by_region() |
includeInterestByRegion: true |
gprop='youtube' |
searchType: "youtube" |
5. Not using Python?
One HTTP call, JSON back:
curl -X POST "https://api.apify.com/v2/acts/jesting_grass~google-trends-api/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"keywords":["chatgpt","claude"],"location":"United States","timeRange":"past_90_days"}'
It also works from n8n / Make / Zapier, and AI agents can call it as a tool through the Apify MCP server.
A note on the 0–100 values
Google Trends numbers are relative: 100 is the peak within the keywords, place and time you compared. Two separate queries aren't on the same scale — if you need that, include a shared "anchor" keyword in each group.
All examples (Python, pandas, Node.js, cURL) are in this repo: github.com/emiohr/google-trends-api. Questions or feature requests — drop a comment.
This article was written with AI assistance and all code was tested against the live API.
Top comments (0)