Skip to main content

CLI tool for Google Trends data analysis and content suggestions

Project description

Google Trends CLI Tool

Google Trends CLI Logo

PyPI version License Build status Python versions

A powerful command-line tool for fetching and analyzing Google Trends data, with special features for content creators looking to identify what topics are worthy of writing about right now.


✨ Features

  • 📈 Real-time Trends: Access trending searches with a simple command
  • 🔍 Deep Analysis: Explore related topics and queries for any search term
  • 📊 Comparative Insights: Compare interest across different topics and timeframes
  • ✍️ Writer Suggestions: Get data-driven content ideas specifically for writers
  • 📱 Geographic Analysis: See how trends vary by region, country, or city
  • 📉 Independent Normalization: Track hundreds of topics with individual trend lines
  • 📰 News Integration: Find trending topics with associated news articles
  • 📁 Multiple Export Formats: Save data as CSV, JSON, or Excel files
  • 🖼️ Visual Reporting: Generate trend visualizations (with matplotlib)

🚀 Installation

# From PyPI
pip install gtrends

# From source
git clone https://github.com/kitabtune/google-trends-cli
cd google-trends-cli
pip install -e .

💻 Quick Start

# Show trending searches
gtrends trending

# Get content suggestions for creators
gtrends suggest-topics

# Find writing opportunities
gtrends writing-opportunities

📖 Usage Examples

Basic Commands

# Show trending searches
gtrends trending

# Show trending searches with news articles
gtrends trending --with-news

# Show topics and queries related to a term
gtrends related "book publishing"

# Compare interest in multiple topics
gtrends compare "fiction books" "non-fiction books" "poetry"

# Get content suggestions for writers
gtrends suggest-topics --category=books

# Find writing opportunities
gtrends writing-opportunities "science fiction" "fantasy"

# Analyze growth patterns for topics (up to 500+ topics)
gtrends topic-growth "science fiction" "fantasy" "romance" "mystery" --period=24h

# Show geographic interest distribution
gtrends geo-interest "literature" --resolution=COUNTRY

# Search for category IDs
gtrends categories --find=book

# Search for location codes
gtrends geo "middle east"

# Show supported timeframe formats
gtrends help-timeframe

For Content Creators

Commands specially designed for content creators looking to identify trending topics:

# Get topic suggestions in the books category
gtrends suggest-topics --category=books --region=US

# Find specific writing opportunities based on rising trends
gtrends writing-opportunities "book publishing" "fiction" --count=10

# Compare interest in publishing trends over time with visualization
gtrends compare "self-publishing" "traditional publishing" --visualize

# Monitor rapid growth patterns for genres (independently normalized)
gtrends topic-growth "mystery" "thriller" "romance" "sci-fi" "fantasy" --period=7d 

Export Options

# Export trending searches to CSV (default)
gtrends trending --export

# Export to a specific location and format
gtrends suggest-topics --export --export-path="~/my-projects" --format=json

# Generate visualization (requires matplotlib)
gtrends compare "poetry" "prose" "fiction" --export --visualize

📋 Available Commands

Command Description
trending Show current trending searches
related Find related topics and queries
suggest-topics Get content creation suggestions
compare Compare interest across topics
writing-opportunities Find specific writing opportunities
topic-growth Track growth for multiple topics
geo-interest Analyze geographic distribution
categories List available content categories
geo Search for location codes
help-timeframe Show timeframe format help

⚙️ Common Options

Option Description
--region, -r Region code (e.g., US, GB, AE)
--count, -n Number of results to display
--timeframe, -t Time range (e.g., 'now 1-d', 'today 3-m')
--export, -e Export results to file
--export-path Directory to save exported data
--format, -f Export format (csv, json, xlsx)
--visualize, -v Generate visualization

🕒 Timeframe Formats

Standard formats:    'now 1-H', 'today 3-m', 'today 12-m'
Custom intervals:    'now 123-H', 'today 45-d', 'today 18-m'
Date-based:          '2024-02-01 10-d', '2024-01-01 2024-12-31'
Hourly precision:    '2024-03-25T12 2024-03-25T15'
All available data:  'all'

📊 Example Outputs

📑 Full Documentation

For complete documentation on all commands and options:

# General help
gtrends --help

# Command-specific help
gtrends [COMMAND] --help

🛠️ Requirements

  • Python 3.8+
  • trendspy
  • click
  • pandas
  • rich
  • python-dateutil
  • matplotlib (optional, for visualizations)
  • pytest (for testing)
  • pytest-cov (for test coverage)

🧪 Development

To set up the development environment:

# Clone the repository
git clone https://github.com/Nao-30/google-trends-cli
cd google-trends-cli

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Check test coverage
pytest --cov=gtrends tests/

Our test suite covers CLI commands, API functionality, content suggestions, formatting utilities, and helper functions. We welcome contributions to expand test coverage.

🤝 Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

⚖️ License

This project is licensed under the MIT License - see the LICENSE file for details.

💖 Acknowledgements

  • TrendsPy for Google Trends data access
  • Click for the command-line interface
  • Rich for beautiful terminal output
  • KitabTune for project sponsorship

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gtrends_cli-0.1.1.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gtrends_cli-0.1.1-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file gtrends_cli-0.1.1.tar.gz.

File metadata

  • Download URL: gtrends_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for gtrends_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 27fe5daec35e080c9887f6d63d5faba3b0ea7f8eb73a49271eab2b807e8bc524
MD5 3e59328bd3f26397b13bd3e5d12d0f65
BLAKE2b-256 b9ba2095a85fa6ffa1c60434ea71e030212b5c0ee4b8c6db694ccc88ae30a671

See more details on using hashes here.

File details

Details for the file gtrends_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gtrends_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for gtrends_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2b5f4170eba34b5668b57e944721449f7ddb1935c12951a1cabacd25e9a6e2a
MD5 bc34133fb1e7a8bf259ab3afcc28e1e9
BLAKE2b-256 7d74329131c9db66fe1d40858a3bd127244513a5e446de28c62640e007ff69f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page