pytrends was the default way to get Google Trends data in Python, but the repository was archived in April 2025 and the last release on PyPI is from 2023. Even before that, most of my time went into 429 errors and sleep loops. Here is how I moved my pytrends scripts to a hosted Actor I maintain on Apify (Google Trends Scraper), call by call.

The same three calls, as one input

A typical pytrends script looks like this:

pytrends.build_payload(["heat pump", "solar panels"], geo="DE", timeframe="today 12-m") pytrends.interest_over_time() pytrends.interest_by_region() pytrends.related_queries() 

With pip install apify-client pandas, the same thing is one run:

from apify_client import ApifyClient import pandas as pd client = ApifyClient("<YOUR_APIFY_TOKEN>") run = client.actor("fjordlabs/google-trends").call(run_input={ "keywords": ["heat pump", "solar panels"], "geos": ["DE"], "timeframe": "past_12_months", # pytrends: "today 12-m" "compareKeywords": True, # shared 0-100 scale, like one build_payload "interestOverTime": True, "interestByRegion": True, "relatedQueriesAndTopics": True, }) rows = list(client.dataset(run.default_dataset_id).iterate_items()) 

Each keyword comes back as its own row with a status: ok, no_data (Google has too little volume) or an error row. Rate limits are retried on fresh IPs inside the run, and failed keywords are not charged.

interest_over_time() as a DataFrame

ok = [r for r in rows if r.get("status") == "ok"] df = pd.DataFrame([ {"date": pd.to_datetime(p["time"], unit="s"), "keyword": r["keyword"], "value": p["value"]} for r in ok for p in r["interestOverTime"] if not p["isPartial"] ]).pivot(index="date", columns="keyword", values="value") print(df.tail()) 

That is the same wide, date-indexed table pytrends gave you, without the isPartial column (partial points are dropped above). Each point also has a readable date label if you prefer that.

interest_by_region() and related_queries()

for r in ok: print(r["keyword"], [g["geoName"] for g in r["interestByRegion"][:5]]) print(" rising:", [q["query"] for q in r["relatedQueries"].get("rising", [])[:5]]) 

Regions are already sorted strongest first. Related topics are in relatedTopics with the same top/rising split.

What changes

  • Timeframes are names (past_7_days, past_5_years, all) or startDate/endDate.
  • geos takes many countries in one run; each keyword-country pair is one row.
  • For big batches, pass resumeFromDatasetId from an earlier run and only the missing keywords are fetched.

Cost

One keyword in one country is $0.002 with all sections included, so 500 keyword-country pairs a week is about $1. Apify's free plan covers that.

Disclosure: I built and maintain the scraper. Questions and feature requests welcome in the comments. Links to Apify include my referral code.