PyTrends Google Trends API Notebook (2026 Refresh)
Google Trends has no open public API yet, so most SEOs reach for PyTrends, the unofficial Python library. The catch is that several of its methods stopped working when Google changed its endpoints, and its GitHub repository was archived in April 2025. This free Google Colab notebook is the tested 2026 version: every method that still works, workarounds for the ones that don’t, and polite rate-limit handling so you get data instead of errors.
Who it’s for
SEOs, content strategists and analysts who want seasonality, regional interest, rising queries or a share-of-search view for a keyword set, without copying charts out of the Google Trends website one at a time. It is also a practical way to check whether a topic is seasonal before you plan content around it, or whether interest is growing or fading over several years. No API key is needed.
How to use it
- Open the notebook in Colab. The first code cell installs PyTrends, TrendSpy and pandas.
- Enter up to five keywords, a timeframe and a location.
- Run keyword suggestions to find the right topic entity for each term, then interest over time, hourly interest or the stitched long daily series.
- Run interest by region, related queries and related topics.
- Check today’s trending searches through TrendSpy and the official Trending now RSS feed.
- Export everything to CSV.
What you get
- Relative interest (0 to 100) over time with a chart, plus each keyword’s share of search
- Country, region, city and DMA breakdowns
- Top and rising related queries and topics in one tidy table, with entity mids
- Workarounds for topic versus search term, and for comparing more than five keywords with an anchor term
- A status table showing which PyTrends methods work, which return errors and which were removed
Limits
These are undocumented endpoints with no published quota. Related queries in particular hit HTTP 429 quickly, so the notebook pauses after every request, backs off on errors and falls back to TrendSpy. If you are still blocked, wait a while or restart the Colab runtime. Trends data is always relative: it shows shape and share, and has no absolute search volumes.
Google announced an official Google Trends API in alpha in July 2025, with access by application. If you get access, it is the more stable route for regular reporting.
The full guide is The Ultimate Guide to PyTrends. To build trends and other data sources into a semantic keyword universe, see Semantic AI-powered SEO Keyword Research.
What’s included
- Every PyTrends method that still works, tested in October 2026
- Related queries with retries, back-off and a TrendSpy fallback when Google returns 429
- Share of search, long daily series and hourly interest
- Top and rising queries and topics in one tidy table, with entity mids
- No API key; CSV exports
Where this resource is used on MLforSEO
Walkthroughs on the blog
More keyword research resources
- No-Code TemplateBlank Semantic Keyword Universe Template (Google Sheets)
- Coding Script or NotebookMultilingual Search Intent Classifier: Regex Filters per Market
- GuideHow Google Uses Entities and the Knowledge Graph: Patent Analysis Sheet
- WorkbookSemantic Keyword Universe Template (Google Sheets, with Sample Data)
- GuideSemantic Keyword Research Beyond SEO: Use Cases by Marketing Area (Guide)
- No-Code TemplateKeyword Categorisation Playground: Google Sheets Formulas and Looker Studio Template
See all 32 keyword research resources →See all 15 reporting resources →See all 73 coding script or notebook resources →
