Disclosure: I built the Apify actor described in this post. It is a paid actor (pay per event). This article was drafted with AI assistance and reviewed by me before publishing.
If you pull Google Trends data in Python, you probably started with pytrends. That repository is now archived on GitHub (read-only, last push August 2024), so open issues will not be fixed.
On top of that, Google rate limits automated Google Trends requests. Scripts that depend on a scraper library tend to hit HTTP 429 sooner or later, and there is nobody left to patch the library when Google changes something.
What I use now
I built an Apify actor that returns Google Trends data as JSON: interest over time, interest by region and related queries, one result per search term. Calling it from Python takes a few lines with apify-client:
from apify_client import ApifyClient
client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("alfhar/google-trends-scraper-pro").call(run_input={
"keywords": ["iphone", "samsung galaxy"], "compareKeywords": True, "geo": "SA", "timeRange": "today 3-m",
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item["keyword"], item["averageInterest"], item["peakDate"])
Install the client with pip install apify-client and use your own Apify API token. compareKeywords puts up to 5 terms on one shared 0-100 scale, like the Google Trends compare view. geo takes country or region codes such as EG, SA, US-CA.
Example output
One dataset item per search term (shortened):
{
"keyword": "bitcoin",
"geo": "EG",
"timeRange": "today 12-m",
"averageInterest": 32.32,
"peakDate": "2026-05-03",
"peakValue": 100,
"interestOverTime": [
{"date": "2025-10-05", "label": "Oct 5 – 11, 2025", "value": 22, "hasData": true, "isPartial": false}
],
"interestByRegion": [
{"geoCode": "EG-JS", "geoName": "South Sinai Governorate", "value": 100}
],
"relatedQueries": {
"top": [{"query": "bitcoin price", "value": 100}],
"rising": [{"query": "bitcoin news today", "value": 484450, "breakout": true}]
}
}
Moving from pytrends
| pytrends | JSON field |
|---|---|
interest_over_time() |
interestOverTime |
interest_by_region() |
interestByRegion |
related_queries() |
relatedQueries.top / .rising
|
Values are relative (0-100), exactly like Google Trends itself, not absolute search counts. Related topics are returned by Google only to some clients, so that list is often empty; related queries work.
A small example client with the same snippet lives here: alf7ar/google-trends-api-python (MIT).
Pricing
Pay per event: $0.005 per actor start plus $0.003 per search term that returns data. Terms that fail are not charged. Check the actor page for current prices.
If something is missing for your use case, open an issue on the actor page and I will take a look.
Top comments (0)