Turn Google Trends into a demand signal with Python

Read the time series, compute a simple trend direction, and the one thing to get right: a Trends value is relative interest, never a search-volume number. Tested August 2026.

You want a number for how much interest a topic is getting right now, to put in a dashboard, decide what to stock, or decide what to write about next. Reading a line chart on the Google Trends website does not scale past one lookup at a time, and it does not fit anywhere a script can use it.

What /v1/trends returns

Send a query to /v1/trends and you get interest_over_time, and inside that a timeline_data list. Each point has a date (a human-readable range like “Aug 23-29, 2026”), a timestamp, and a values list with one entry per query you asked about, each carrying a value from 0 to 100. Our sample, for the query “web scraping api”, came back as 53 weekly points spanning about a year, for 5 credits.

The number is relative, never absolute

This is where it goes wrong most often: a Trends value is not a count of searches. It is an index, scaled so the single highest point in the range you asked for is 100 and every other point is a fraction of that peak. A value of 14 does not mean 14 searches or 14 of anything countable. It means 14 percent of whatever the busiest week in that window was.

That has two consequences people miss. First, you cannot compare a value from one query against a value from a different query and conclude one topic gets searched more, because each is scaled against its own peak, not a shared baseline. Second, a value computed over one date range or one location is not comparable to a value computed over a different one, for the same reason: change the window and every point gets rescaled against a new peak. If you need two topics on the same scale, request them together in one call so they share a baseline, or compare shape (rising, falling, flat) instead of raw level.

Reading the series and a trend direction

import requests

API_KEY = "faf_live_..."  # your FastAF key

resp = requests.get(
    "https://api.fastaf.co/v1/trends",
    params={"query": "web scraping api", "data_type": "TIMESERIES"},
    headers={"Authorization": f"Bearer {API_KEY}"},
    timeout=60,
)
resp.raise_for_status()

points = resp.json()["interest_over_time"]["timeline_data"]
series = [(p["date"], p["values"][0]["value"]) for p in points]

for date, value in series[-8:]:
    print(f"{date:<26} {value:>3}")

recent = [v for _, v in series[-8:]]
prior = [v for _, v in series[-16:-8]]
recent_avg = sum(recent) / len(recent)
prior_avg = sum(prior) / len(prior)
change = (recent_avg - prior_avg) / prior_avg * 100
direction = "rising" if change > 10 else "falling" if change < -10 else "flat"

print(f"recent avg {recent_avg:.1f} vs prior avg {prior_avg:.1f}: {direction} ({change:+.1f}%)")

On our sample this printed the last eight weeks, bouncing between 5 and 88, with a recent average of 37.9 against a prior eight-week average of 84.6: a 55 percent drop, labeled “falling.” Whether eight weeks is the right window depends on how the topic normally moves. A slower-moving category might compare 90-day blocks instead of two 8-week ones; the shape of the calculation stays the same.

Put it to use

A dashboard row just needs the latest value and the direction label, refreshed on whatever cadence matches how often the underlying interest actually moves: daily is overkill for a series that only reports in weekly buckets, like our sample. For a stock-or-write decision, direction matters more than absolute level: a topic climbing from 20 to 40 is a clearer signal than a topic that has been sitting at 80 for months, even though 80 sounds like the bigger number.

What it costs

A call is 5 credits, regardless of how many weeks come back in the series, so backfilling a dashboard with a year of history and refreshing it weekly both cost the same 5 credits. Failed requests are not charged.

Start with the free tier, 500 credits and no card, which is 100 calls: enough to pull the series for every topic you are deciding between before committing to tracking any of them.