Google Trends API for Python in 2025: pytrends vs Scraper
Google Trends has no official API. Learn why pytrends breaks, how the SERP API approach works, and the fastest way to pull trend data into Python without getting rate-limited.
The actor referenced in this article is live on Apify. Pay only for results delivered.
Google Trends is one of the most valuable free datasets in SEO and market research. But there is no official API. The unofficial workarounds break constantly. This guide covers what works in 2025.
The problem with pytrends
pytrends is the most popular Python library for Google Trends. It reverse-engineers the same endpoint your browser uses. The problem: Google rate-limits it aggressively.
# This works for about 100 requests before you hit 429
from pytrends.request import TrendReq
pytrends = TrendReq(hl='en-US', tz=360)
pytrends.build_payload(['python', 'javascript'], timeframe='today 12-m')
df = pytrends.interest_over_time()
After a few hundred requests you get ResponseError: The request failed: Google returned a response with code 429. Adding time.sleep() helps but does not solve it at scale.
What data Google Trends actually provides
Google Trends returns four datasets per query:
Interest over time — a 0-100 index per time period, normalized to peak search volume. Not absolute search counts.
Interest by region — the same index broken down by country, state, or city depending on zoom level.
Related queries — the top 25 related search terms and 25 rising terms (those with a significant recent increase).
Related topics — broader topic entities related to your keyword.
Getting clean data with the Apify actor
The Google Trends Scraper Pro handles rate limiting via residential proxy rotation. Input is simple:
import apify_client
client = apify_client.ApifyClient('YOUR_APIFY_TOKEN')
run_input = {
"keywords": ["python", "javascript", "typescript"],
"timeframe": "today 12-m",
"geo": "US",
"category": 0,
}
run = client.actor('themineworks/google-trends-pro').call(run_input=run_input)
for item in client.dataset(run['defaultDatasetId']).iterate_items():
print(item['keyword'], item['interest_over_time'])
Comparing keywords
Google Trends normalizes all keywords to the same 0-100 scale relative to the keyword with the highest search interest. When comparing “python” vs “javascript”, the one with more searches gets 100 and the others scale proportionally.
This means you cannot compare data from two separate queries — you must put all keywords in the same payload.
Regional breakdown
To get state-level data for the US:
run_input = {
"keywords": ["python"],
"timeframe": "today 5-y",
"geo": "US",
"resolution": "REGION", # returns states
}
For city-level: use "resolution": "CITY". For country-level: set "geo": "" (empty string = worldwide).
Scheduling trend monitoring
Run the actor on a weekly schedule via Apify Scheduler and push results to a spreadsheet or database. This lets you track rising trends before they peak — useful for content planning and keyword research.
Pricing
First 25 results free on every Apify account. Pay only per result returned. Zero charge on failed or empty runs.
Try the scraper referenced in this article — live on Apify, pay only for results.
Open google-trends-pro on Apify →Frequently asked questions
Does Google Trends have an official API? +
No. Google shut down the Google Trends API in 2007 and never replaced it. pytrends and scrapers reverse-engineer the unofficial endpoint.
Why does pytrends stop working? +
pytrends sends requests from your IP directly to Google, which rate-limits and blocks after a few hundred requests. A scraper with rotating proxies avoids this.
Can I get historical Google Trends data back to 2004? +
Yes. Google Trends data goes back to January 2004. Date resolution changes: daily under 90 days, weekly up to 5 years, monthly for longer ranges.
How to Scrape AmbitionBox Company Reviews and Ratings
AmbitionBox is India largest employer review platform with 300,000 companies. Learn how to pull ratings, review counts, salary data, and dimension scores as structured JSON without any official API.
AliExpress Product Data API: Prices, Ratings, and Orders in Python
AliExpress affiliate API has restricted coverage. Learn how to scrape AliExpress product listings for prices, ratings, order counts, and seller data as structured JSON — no affiliate approval needed.
ClinicalTrials.gov API v2: How to Search 500,000 Studies and Track Trial Status
ClinicalTrials.gov upgraded to a v2 REST API in 2024. Here is how to use it, what changed from v1, and how to build automated trial monitoring pipelines in Python.