DEV Community

Himanshu Agrawal
Himanshu Agrawal

Posted on Edited on

Google Trends API in Python: Supabase vs Firebase in 4 Calls (No pytrends)

Disclosure: I built the Google Trends API used in this guide and earn from its paid plans on RapidAPI.

Before you pick a backend, write a tutorial or name a feature, it helps to know which way search interest is moving. Google Trends has that answer for almost any topic. Getting it into Python is the annoying part in 2026:

  • pytrends, the library most tutorials use, was archived on 17 April 2025. When I tested it on 10 November 2026, interest over time still worked, but both of its trending searches calls failed with a 404 error.
  • Google's official Trends API is an alpha. You apply, and access opens to a limited number of developers.

So this guide uses a hosted Google Trends API on RapidAPI with plain requests. To keep it concrete, it answers a question developers actually argue about: is Supabase catching up with Firebase, and where? Four calls, all inside the free plan.

Setup

Subscribe to the Basic plan on the API page (free, 50 requests a month) and copy your x-rapidapi-key. Keep it out of your code:

export RAPIDAPI_KEY="your-key"
Enter fullscreen mode Exit fullscreen mode

On Windows, use set RAPIDAPI_KEY=your-key. One small helper covers every endpoint:

import os
import requests

HOST = "google-trends-api15.p.rapidapi.com"
HEADERS = {"x-rapidapi-host": HOST, "x-rapidapi-key": os.environ["RAPIDAPI_KEY"]}


def get(path, **params):
    resp = requests.get(f"https://{HOST}{path}", params=params, headers=HEADERS, timeout=90)
    resp.raise_for_status()
    return resp.json()["data"]
Enter fullscreen mode Exit fullscreen mode

Every response has success, count, cached and data. The helper returns data.

Step 1: Five years of search interest

trend = get("/google-trends/v1/interest", q="supabase, firebase", time="5y")
terms = trend["terms"]
weeks = [p for p in trend["points"] if not p["isPartial"]]  # skip the week still in progress

by_year = {}
for p in weeks:
    by_year.setdefault(p["date"][:4], []).append(p["values"])

print("year " + "".join(f"{t:>10}" for t in terms))
for year, rows in sorted(by_year.items()):
    print(year + " " + "".join(f"{sum(r[t] for r in rows) / len(rows):>10.1f}" for t in terms))

leader = max(terms, key=lambda t: weeks[-1]["values"][t])
streak = 0
for p in reversed(weeks):
    if max(terms, key=lambda t: p["values"][t]) != leader:
        break
    streak += 1
peak = max(weeks, key=lambda p: p["values"][leader])
print(f"{leader} has led for {streak} weeks in a row, since {weeks[-streak]['date'][:10]}")
print(f"{leader} peaked in the week of {peak['date'][:10]}")
Enter fullscreen mode Exit fullscreen mode

Output (run on 11 November 2026, worldwide):

year   supabase  firebase
2021        0.0      10.0
2022        0.9      19.0
2023        2.0      17.8
2024        4.3      17.4
2025       15.1      22.1
2026       30.9      23.6
supabase has led for 39 weeks in a row, since 2026-02-08
supabase peaked in the week of 2026-05-24
Enter fullscreen mode Exit fullscreen mode

Trends values are relative: 100 is the busiest single week for either term in this range and place, and every other week is scaled to it. Both terms came from one call, so they share that scale and compare directly. (2021 has only its last eight weeks, so skip that row.)

The story is clear anyway. Firebase stayed between about 17 and 24 for four years, while Supabase went from almost nothing to the lead. It has been ahead every week since February 2026 and peaked in late May. Both have cooled since June, so compare averages, not single weeks.

Step 2: Where each one wins

regions = get("/google-trends/v1/regions", q="supabase, firebase", time="12m")
first, last = regions["terms"][0], regions["terms"][-1]
by_share = sorted(regions["regions"], key=lambda r: r["values"][first], reverse=True)

print(f"{len(by_share)} countries, {first} share of {first} + {last} searches:")
for r in by_share[:5]:
    print(f"  {r['name']:<16}{r['values'][first]}%")
print("  ...")
for r in by_share[-5:]:
    print(f"  {r['name']:<16}{r['values'][first]}%")
Enter fullscreen mode Exit fullscreen mode
71 countries, supabase share of supabase + firebase searches:
  United States   64%
  Brazil          64%
  Norway          64%
  Singapore       63%
  Netherlands     63%
  ...
  Sri Lanka       40%
  India           40%
  Egypt           40%
  Pakistan        39%
  Bangladesh      33%
Enter fullscreen mode Exit fullscreen mode

In a comparison, a country's values are shares of the same searches, so they add up to 100. Supabase gets close to two thirds of these searches in the US and Brazil and around 60% in most of Western Europe, while Firebase still leads in South Asia and Egypt. If you write tutorials or sell to developers, that tells you which stack developers in each market are reading about.

Step 3: What people search around Supabase

queries = get("/google-trends/v1/related", q="supabase", time="90d")[0]
term = queries["term"]
print("Top:", ", ".join(item["query"] for item in queries["top"][:10]))

top = {item["query"] for item in queries["top"]}
print("Rising:")
for item in queries["rising"]:
    growth = "Breakout" if item["isBreakout"] else f"+{item['value']:,}%"
    related = term in item["query"] or item["query"] in top
    print(f"  {'keep' if related else 'skip'}  {item['query']} ({growth})")
Enter fullscreen mode Exit fullscreen mode
Top: supabase github, github, supabase docs, what is supabase, supabase database, supabase pricing, vercel, supabase storage, supabase login, supabase auth
Rising:
  skip  best time to visit maldives (Breakout)
  skip  how to bake a cake (+2,350%)
  skip  cheapest flights to tokyo (+1,650%)
  skip  best laptop for work (+1,000%)
  skip  top tourist attractions in paris (+550%)
  keep  netlify (+130%)
  keep  vercel (+70%)
  keep  supabase login (+70%)
  keep  cloudflare (+60%)
Enter fullscreen mode Exit fullscreen mode

The top list is a ready-made content plan: "what is supabase", "supabase pricing" and "supabase auth" are questions people type every day. The rising list needs a filter. In this run, its five fastest risers were travel, cooking and laptop searches with nothing to do with Supabase. My guess is automated traffic, such as AI agents testing a search tool, but it is what Google returned, so the code keeps a rising search only if it contains the term or also appears in the top list. "Breakout" means growth of more than 5,000%.

Step 4: What is trending right now

This is the call pytrends lost. It returns the searches trending in a country in the past 24 hours, in Google's order, with a rough search volume (trafficApprox is a lower bound, so 2000 means 2,000+), the start time, related queries and news articles. A watch list turns it into an alert:

WATCH = ["nintendo", "starlink", "openai", "nvidia", "iphone", "supabase"]

now = get("/google-trends/v1/trending", geo="US", limit=10)
print(len(now), "searches trending in the US right now")
for t in now:
    if any(word in t["title"].lower() for word in WATCH):
        print(f"  {t['title']}: {t['trafficApprox'] or 0:,}+ searches, trending since {t['startedAt'][11:16]} UTC")
Enter fullscreen mode Exit fullscreen mode
10 searches trending in the US right now
  starlink mini 2: 500+ searches, trending since 18:50 UTC
  nintendo: 2,000+ searches, trending since 17:50 UTC
Enter fullscreen mode Exit fullscreen mode

Ten searches were trending and two matched the watch list. Run this every hour from cron or a GitHub Action, send the matches to Slack, and you hear about news in your niche while it is still rising. It is the slowest endpoint (about 40 seconds in my test), which is why the helper waits up to 90 seconds.

What it costs

Each call is one request, so this tutorial used 4 of the 50 free monthly requests on the Basic plan. If you outgrow it: Pro is $9.99 a month for 600 requests, Ultra $29.99 for 2,000 and Mega $99 for 6,000.

Answers are cached for 1 hour (trending searches for 15 minutes), and a cached answer says "cached": true. Rerunning a notebook while you work is fast, but each call still counts as a request.

Limits worth knowing

  • Values are relative, not search counts. Low-volume terms show as 0, and Google samples its data, so two requests for the same query can differ slightly.
  • Up to 5 terms per call. To compare more, keep one anchor term in every call and rescale the others against it.
  • A search term counts every search that contains it. "supabase" is unambiguous; "python" also counts people looking for snakes.
  • time takes 1h, 4h, 1d, 7d, 30d, 90d, 12m, 5y or all. For exact dates, pass from and to as YYYY-MM-DD. from is a Python keyword, so write get(path, q="supabase", **{"from": "2026-01-01", "to": "2026-06-30"}).
  • geo takes a country (US) or a region (US-CA). With resolution, /regions also returns regions, cities or US metros.
  • property switches to news, images, youtube or shopping searches, and category takes a Google Trends category id.
  • When you publish the numbers, cite Google Trends as the source, as Google asks.

Note: this tutorial was written with AI assistance. The outputs are from real API calls, and the code was tested against those responses.

Top comments (0)