For years, the default way to get Google Trends data in code was pytrends. Today it's a frustrating choice: the repository is archived, it no longer gets fixes, and many people now see 429 Too Many Requests on the very first call.
This post covers why that happens, what your options are, and how to get Trends data without managing it yourself. Disclosure: the hosted option at the end is a tool I built.
Why Google Trends returns 429s
Google Trends has no public API that anyone can use (more on the official one below). Libraries like pytrends call the same internal endpoints the Trends website uses. Google limits how often those endpoints can be called, and it doesn't publish the limits. When you go over, you get a 429 and have to wait.
The limits are stricter for traffic from cloud servers than from home connections, which is why a script that works on your laptop often fails on a server or in a notebook environment.
Your options
1. Keep a library and slow it down. Space requests out by several seconds, retry with exponential backoff (wait 2 s, then 4 s, then 8 s…), and cache results so you don't ask twice. This works for small, occasional jobs. It gets painful when you need hundreds of keywords.
2. Apply for the official Google Trends API. Google opened an alpha of an official Trends API in 2025. It returns consistently scaled data, which the website doesn't. Access is by application, it's limited to approved testers, and there's no general release date yet. If Trends data matters to your product, apply now.
3. Use a hosted scraper. Someone else deals with retries, pacing, and changes to the site, and you call an API.
Using a hosted Google Trends scraper
I built the Google Trends Scraper on Apify for my own keyword research. For each search term it returns:
- Interest over time: the 0–100 timeline for any period, from the past hour to 2004 onward, or exact dates.
- Interest by region: countries, states, cities, or US metro areas (DMA).
- Related searches: top and rising queries, with a flag for "Breakout" (growth over 5,000%).
- Comparisons: up to 5 terms on the same scale.
- Trending Now: today's trending searches per country, with traffic estimates and news links.
It paces itself, backs off when Google rate-limits it, and only charges for terms that return data: failed lookups and terms with no data are free.
From the web UI
Enter your terms, a location such as US or US-CA, and a time range, then click Start. You can download the results as JSON, CSV or Excel.
From code
Apify can run it and return the results in one HTTP call. Get your API token from Settings → API & Integrations in Apify Console, and keep it out of your code and repositories (use an environment variable).
With curl:
curl -X POST "https://api.apify.com/v2/acts/rsiddiq95~google-trends-scraper/run-sync-get-dataset-items" \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"searchTerms": ["air fryer", "standing desk"], "geo": "US", "timeRange": "today 12-m"}'
With Python:
import os
import requests
resp = requests.post(
"https://api.apify.com/v2/acts/rsiddiq95~google-trends-scraper/run-sync-get-dataset-items",
headers={"Authorization": f"Bearer {os.environ['APIFY_TOKEN']}"},
json={"searchTerms": ["air fryer", "standing desk"], "geo": "US", "timeRange": "today 12-m"},
timeout=300,
)
for row in resp.json():
if row["resultType"] == "keyword":
print(row["searchTerm"], row["averageInterest"])
Each keyword comes back as one record:
{
"resultType": "keyword",
"hasData": true,
"searchTerm": "air fryer",
"geo": "US",
"timeRange": "today 12-m",
"averageInterest": 65,
"interestOverTime": [{ "date": "2025-10-26T00:00:00.000Z", "value": 52, "isPartial": false }],
"interestByRegion": [{ "geoCode": "US-WY", "geoName": "Wyoming", "value": 100 }],
"relatedQueries": {
"top": [{ "query": "air fryer chicken", "value": 100 }],
"rising": [{ "query": "best air fryer 2026", "formattedValue": "Breakout", "isBreakout": true }]
},
"trendsUrl": "https://trends.google.com/trends/explore?q=air+fryer&date=today+12-m&geo=US"
}
It costs $2.50 per 1,000 keywords and $1 per 1,000 trending searches, with no platform fees on top. Apify's free plan includes monthly credit.
Things to know about Trends data (whatever tool you use)
- Values are relative. 100 is the peak within your query, not a search volume. If you want two keywords on the same scale, compare them in one query.
- Results can shift slightly between runs, because Google re-scales each request. Use exact date ranges for reports you want to reproduce.
- Related topics aren't available from my scraper, because Google doesn't provide them to automated tools.
- Classic Explore is going away. Google shows a notice on the Trends site that the "classic Explore" page is expiring soon, with no date announced. The new version requires signing in. Every unofficial Trends tool reads the classic version, so expect disruption when it shuts down. That's another reason to apply for the official API if you depend on this data.
If you have questions or need a feature, open an issue on the Actor page.
Top comments (0)