The Mine Works
Browse on Apify
pytrends is Dead: The Best Google Trends Alternatives in 2025
← All posts
comparison November 17, 2025 · 6 min read

pytrends is Dead: The Best Google Trends Alternatives in 2025

pytrends breaks constantly and its maintainer has stepped back. Here are the working alternatives for getting Google Trends data programmatically in 2025.

Try the scraper

The actor referenced in this article is live on Apify. Pay only for results delivered.

Open on Apify →

pytrends was a beloved Python library for accessing Google Trends data. It was unofficial (Google has no public Trends API), maintained by a single developer, and worked well enough for years. Today it is effectively dead.

TL;DR: pytrends hasn’t been meaningfully updated since 2022 and fails consistently on cloud servers because Google blocks datacenter IPs from widgetdata endpoints. Working alternatives: direct HTTP with a residential proxy, a managed Google Trends scraper at $0.006/keyword, or SerpAPI at $75/month for 5,000 searches. Google Keyword Planner gives absolute volumes for free.

Here is the current state of pytrends and every alternative worth considering.

What Happened to pytrends

pytrends works by reverse-engineering Google Trends’ internal API. The library has not had a meaningful update since 2022. GitHub issues report consistent 429 errors, empty data returns, and API format changes that the library does not handle.

The root technical problem: Google moved the widgetdata API behind datacenter IP blocking. pytrends runs from your local machine (residential IP) and may work interactively, but runs from cloud servers — which is where you actually want to use it — get blocked.

The library also does not handle Google’s XSSI prefix ()]}',\n) correctly in all cases, and the req= parameter encoding for newer Trends features has changed.

Alternative 1: Direct HTTP with Explore + Widgetdata

The architecture that actually works:

  1. Call /trends/api/explore to get widget tokens (no residential IP needed)
  2. Call /trends/api/widgetdata/* with those tokens using a residential proxy

This is not a public API — it is the same reverse-engineering approach as pytrends, done correctly.

import requests
import json
import re
import urllib.parse

def get_trends(keyword: str, timeframe: str = 'today 12-m', geo: str = 'US', proxy: str = None) -> dict:
    session = requests.Session()
    
    proxy_config = {'https': proxy} if proxy else None
    
    # 1. Seed NID cookie
    session.get('https://trends.google.com/trends/', proxies=None, timeout=10)
    
    # 2. Get widget tokens (no proxy needed)
    explore_params = {
        'hl': 'en-US',
        'tz': '-330',
        'req': json.dumps({
            'comparisonItem': [{'keyword': keyword, 'geo': geo, 'time': timeframe}],
            'category': 0,
            'property': '',
        }),
        'token': 'APP6_UEAAAAAZ...',  # Not needed for explore
    }
    
    explore_url = 'https://trends.google.com/trends/api/explore'
    resp = session.get(explore_url, params=explore_params, timeout=15)
    
    # Strip XSSI prefix
    data = json.loads(resp.text.lstrip(")]}',\n"))
    widgets = data.get('widgets', [])
    
    results = {}
    
    # 3. Fetch each widget's data (requires residential proxy)
    for widget in widgets:
        widget_id = widget.get('id')
        endpoint_map = {
            'TIMESERIES': 'multiline',
            'GEO_MAP': 'comparedgeo',
            'RELATED_QUERIES': 'relatedsearches',
            'RELATED_TOPICS': 'relatedsearches',
        }
        
        if widget_id not in endpoint_map:
            continue
        
        endpoint = endpoint_map[widget_id]
        widget_url = f'https://trends.google.com/trends/api/widgetdata/{endpoint}'
        
        widget_resp = session.get(
            widget_url,
            params={
                'hl': 'en-US',
                'tz': '-330',
                'req': json.dumps(widget['request']),
                'token': widget['token'],
            },
            proxies=proxy_config,
            timeout=20,
        )
        
        widget_data = json.loads(widget_resp.text.lstrip(")]}',\n"))
        results[widget_id] = widget_data
    
    return results

Requires: A residential proxy for the widgetdata calls. Works from cloud infrastructure.

Our Google Trends Pro actor implements the explore + residential widgetdata pattern with automatic proxy rotation. No proxy subscription required — Apify’s RESIDENTIAL pool is included.

from apify_client import ApifyClient

client = ApifyClient('YOUR_API_TOKEN')
run = client.actor('themineworks/google-trends-pro').call(run_input={
    'keywords': ['python scraping', 'apify', 'bright data'],
    'timeframe': 'today 12-m',
    'geo': 'US',
    'includeRelatedQueries': True,
    'includeInterestByRegion': True,
})

for item in client.dataset(run['defaultDatasetId']).iterate_items():
    print(item['keyword'])
    print(f"  Peak interest: {max(p['value'] for p in item['interest_over_time'])}")
    rising = item.get('related_queries', {}).get('rising', [])
    print(f"  Rising queries: {[r['query'] for r in rising[:3]]}")

Alternative 3: Google Keyword Planner (Absolute Volumes)

If you need absolute search volumes rather than relative trends indices, Google Keyword Planner (part of Google Ads) is the authoritative source. Requires a Google Ads account (free to create, no spending required).

The limitation: Keyword Planner gives monthly search volume estimates in ranges (1K-10K), not precise numbers, and only updates monthly.

Alternative 4: Third-Party SEO Tools

Ahrefs, Semrush, and Moz all provide keyword volume data from their own panel-based estimates. These are more accurate for absolute volumes than Google Trends, but cost $99-299/month.

For trend direction (rising vs declining), Google Trends remains more accurate than SEO tool estimates because it uses real Google search data rather than panel extrapolation.

SerpAPI offers a Google Trends endpoint that abstracts the scraping layer. Pricing is per API call. The data quality matches direct Google Trends access.

import requests

params = {
    'engine': 'google_trends',
    'q': 'python scraping',
    'date': 'today 12-m',
    'api_key': 'YOUR_SERPAPI_KEY',
}
data = requests.get('https://serpapi.com/search', params=params).json()

Cost: SerpAPI charges $75/month for 5,000 searches. More expensive than direct access at scale.

Comparison Table

OptionMonthly CostRequires ProxyMaintenanceReliability
pytrends (cloud)FreeYesDIYLow
Direct HTTP (correct)Proxy cost onlyYesDIYHigh
Google Trends ProUsage-basedNoNoneHigh
SerpAPI$75+NoNoneHigh
Google Keyword PlannerFreeNoNoneMedium (absolute vol only)

Bottom Line

pytrends is not worth maintaining in 2025 for cloud usage. The direct HTTP approach works but requires a residential proxy subscription and maintenance when Google updates its API. For most developers, a managed solution is the practical choice — you pay a small per-query cost and get reliable data without any infrastructure work.

Frequently Asked Questions

Is pytrends still maintained in 2025?

pytrends has not received a meaningful update since 2022. The maintainer has effectively stepped back from the project. Current GitHub issues document consistent failures including 429 errors on cloud servers, empty data returns, and broken XSSI prefix handling. It is not recommended for production or any cloud-based deployment.

What replaced pytrends for production Google Trends data?

The most robust replacement is a direct HTTP implementation using Google’s explore/widgetdata endpoint pattern with a residential proxy for the widgetdata calls. Managed services like Google Trends Pro abstract this entirely. SerpAPI’s Google Trends endpoint costs $75/month for 5,000 searches. Google Keyword Planner provides absolute monthly volumes for free but not trend direction.

Why does Google Trends block datacenter IPs?

Google Trends blocks datacenter IP ranges — AWS, GCP, Azure — from accessing the widgetdata API endpoints where interest over time, related queries, and regional breakdowns live. The explore endpoint works from any IP to return widget tokens, but the actual data requests require a residential or mobile IP.

What does Google Trends Pro cost compared to pytrends plus a proxy?

pytrends is free but requires a residential proxy subscription ($30–100/month) to work reliably on cloud infrastructure. Google Trends Pro charges $0.006 per keyword report with zero charge on failures. For production workloads with 100–500 keywords per month, the managed option is cost-competitive with DIY costs once developer time is factored in.

Does Google Keyword Planner give the same data as Google Trends?

No. Google Keyword Planner gives monthly search volume estimates from Google Ads data, in ranges like 1K–10K per month. Google Trends gives relative search interest indexed 0–100 showing trend direction over time. Use Keyword Planner for absolute volumes; use Trends for understanding whether a topic is rising, declining, or seasonal.

Related Actor

Try the scraper referenced in this article — live on Apify, pay only for results.

Open google-trends-pro on Apify →

Frequently asked questions

Is pytrends still working in 2025? +

pytrends works from residential IP addresses but fails consistently from cloud servers and Docker containers. Google blocks datacenter IP ranges from the widgetdata endpoints where actual trend data lives.

What is the best pytrends alternative in 2025? +

For production use, a managed scraper like Google Trends Pro handles the residential IP routing automatically. For light local use, pytrends with a residential proxy still works.

Why does pytrends return empty data arrays? +

Empty data usually means the widgetdata request was blocked by Google. The explore endpoint returns a 200 with widget tokens, but the downstream widgetdata calls return 429s from datacenter IPs.

Can I get Google Trends data without pytrends? +

Yes. The Google Trends Pro actor on Apify provides reliable trend data including interest over time, interest by region, and related queries without any proxy setup.