DEV Community

Resolver Data
Resolver Data

Posted on

Google Trends data in Python without the 429 errors

Google Trends is one of the best free signals for demand: is "air fryer" growing or fading, which countries search for it most, and what people search for next to it.

Getting that data into code is the annoying part. Unofficial libraries break when Google changes something, and after a handful of requests you start seeing 429 Too Many Requests.

Here is a setup that keeps working: a hosted scraper that handles sessions, retries and proxies for you, and returns clean JSON.

What you get per keyword

The Google Trends Scraper returns one record per keyword with:

  • interestOverTime: a list of {date, label, value, isPartial} points (0-100, Google's scale)
  • averageInterest: the mean of those values
  • interestByRegion: countries or states sorted by interest, with codes
  • relatedQueries and relatedTopics: top and rising searches

Run it from Python

pip install apify-client pandas
Enter fullscreen mode Exit fullscreen mode
from apify_client import ApifyClient
import pandas as pd

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("resolver/google-trends-scraper-reliable").call(run_input={
    "keywords": ["air fryer", "slow cooker", "rice cooker"],
    "geo": "US",                  # empty string = worldwide
    "timeframe": "today 12-m",    # same values as the Trends website
    "compare": True,              # put all keywords on one scale
    "includeRegions": True,
    "includeRelated": True,
})

rows = []
for rec in client.dataset(run["defaultDatasetId"]).iterate_items():
    for point in rec.get("interestOverTime", []):
        rows.append({"keyword": rec["keyword"], "date": point["date"], "value": point["value"]})

df = pd.DataFrame(rows).pivot(index="date", columns="keyword", values="value")
print(df.tail())
Enter fullscreen mode Exit fullscreen mode

You now have a date × keyword table you can chart, export to Sheets, or feed into a forecast.

compare on or off?

  • On: all keywords share one 0-100 scale, like typing them together on the Trends site. Use this to see which term is bigger.
  • Off: each keyword gets its own 0-100 scale. Use this to see the shape of each trend on its own.

Ideas

  • Content planning: check relatedQueries → "rising" every week and write about what's climbing.
  • Product research: compare product names across countries with geo and pick where to launch.
  • Seasonality: use today 5-y to see which months peak, and plan stock or ads around them.

Price

$10 per 1,000 keywords. No subscription; Apify's free monthly credit covers small projects.

Top comments (0)