If you have used pytrends, you know the moment: the script worked yesterday, today it only returns TooManyRequestsError: 429. You add sleeps, rotate user agents, try a proxy, and it works for a while. The library is no longer maintained, and Google keeps tightening the limits.
Google announced an official Trends API in 2025, but it is in alpha with access on request. So for most of us the options are the website, an unofficial library, or a hosted scraper that deals with the rate limits for you.
This post shows the third option in Python, with real output. I built the tool it uses, a Google Trends Scraper on Apify, so take this as a field report from the author.
Setup
pip install apify-client
export APIFY_TOKEN="your_apify_token" # free account, Settings > API & Integrations
Interest over time, by region, and related queries
One call per keyword:
import os
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("data_xplorer/google-trends-fast-scraper").call(run_input={
"mode": "keyword",
"keyword": "ai agents",
"predefinedTimeframe": "today 12-m", # now 1-h ... today 5-y
"geo": "US", # "" for worldwide
"fetchRegionalData": True,
"fetchRelatedQueries": True,
}, logger=None)
item = next(client.dataset(run["defaultDatasetId"]).iterate_items())
points = item["timeline_data"]["ai agents"] # {"2025-11-30": 29, ...}
peak = max(points, key=points.get)
print(f"{len(points)} weekly points, peak {points[peak]} on {peak}")
for q in item["related_queries"]["top"][:5]:
print("top ", q["query"], q["formattedValue"])
for q in item["related_queries"]["rising"][:3]:
print("rising ", q["query"], q["formattedValue"])
What it printed on December 4, 2026:
53 weekly points, peak 100 on 2026-06-07
top best ai agents 100
top ai agent 47
top ai news 40
top what are ai agents 25
top autonomous ai agents 17
rising openclaw Breakout
rising moltbook Breakout
The same item also has region_data (US states ranked 0 to 100) and the link to the same chart on the Google Trends website (trends_url), handy to double-check a number.
Two things worth knowing:
- Each keyword is scaled 0 to 100 on its own peak. Comparing the shape of two curves is fine; comparing their absolute volume needs both keywords in one Google Trends chart.
- For a keyword with too little search volume, you get an
errorfield in plain words ("Not enough search volume...") within seconds, instead of a script that retries forever.
What is trending right now
Google's "Trending now" list, for 125 countries:
run = client.actor("data_xplorer/google-trends-fast-scraper").call(run_input={
"mode": "trending",
"trendingSearchesCountry": "US",
"trendingSearchesTimeframe": "24", # last 4, 24, 48 or 168 hours
"trendingSearchesMaxItems": 25,
}, logger=None)
item = next(client.dataset(run["defaultDatasetId"]).iterate_items())
for s in item["trending_searches"]:
print(s["rank"], s["term"], s["trend_volume_formatted"], s["related_terms"][:2])
1 toulouse vs psg 50K+ ['toulouse vs psg', 'toulouse fc vs psg standings']
4 llbean exiting japanese retail market 20K+ ['llbean exiting japanese retail market', 'l.l.bean']
...
Run it every hour, append to a CSV, and you have your own history of what trended and when, something the website does not keep for you.
A ready-made script
If you would rather not write the loop yourself, there is a small open source CLI that wraps all of this and writes CSV files:
git clone https://github.com/dataxplore19/google-trends-api-python.git
cd google-trends-api-python && pip install -r requirements.txt
python trends.py interest chatgpt gemini --geo US --timeframe "today 3-m" --regions
python trends.py trending --country GB --watch "bitcoin,nvidia" # alert on a match
It is a drop-in way to replace pytrends calls in an existing notebook: read the CSV with pandas and keep the rest of your analysis.
Other ways to use it
- Node.js: google-trends-api-node
- No code, in n8n: ready-to-import templates, including a trend alert to Telegram
- From Claude, Cursor or VS Code: the Google Trends MCP server, so your assistant can look up a trend by itself
Limits, honestly
- One keyword per call. Five keywords means five calls (they run fast, a few seconds each).
- It is still Google's data, with Google's sampling: tiny differences between two runs of the same query are normal, the website does the same.
- "Related topics" (entities, as opposed to related queries) are not available yet.
Disclosure: I built the Google Trends Scraper used in this post. Links to apify.com are referral links: if you create an Apify account through them, I may earn a commission at no cost to you.
Top comments (0)