Skip to content

promptinprod/gsc-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

gsc-cli

CLI tool for Google Search Console API.

Install

pip install -e .

Setup

  1. Create a Google Cloud project and enable the Search Console API
  2. Create OAuth credentials (Desktop app) and download client_secrets.json
  3. Place it in ~/.config/gsc/client_secrets.json
  4. Run gsc auth login

Usage

# Authentication
gsc auth login                    # OAuth login
gsc auth status                   # Check auth status

# Properties
gsc properties list               # List all properties
gsc properties use sc-domain:example.com  # Set default site
gsc properties details            # Show property details

# Analytics
gsc analytics search              # Basic search analytics
gsc analytics search --days 7 --dimensions query,page
gsc analytics advanced --filter-dim country --filter-expr usa
gsc analytics overview            # Performance overview with daily trend
gsc analytics compare --p1-start 2025-01-01 --p1-end 2025-01-31 \
                       --p2-start 2025-02-01 --p2-end 2025-02-28
gsc analytics page --page https://example.com/blog/post

# URL Inspection
gsc urls inspect --url https://example.com/page
gsc urls batch-inspect --url https://a.com --url https://b.com
gsc urls batch-inspect --urls-file urls.txt
gsc urls check-indexing --url https://a.com --url https://b.com

# Sitemaps
gsc sitemaps list
gsc sitemaps details --sitemap https://example.com/sitemap.xml
gsc sitemaps submit --sitemap https://example.com/sitemap.xml
gsc sitemaps delete --sitemap https://example.com/sitemap.xml

Global Options

--json, -j          Output raw JSON (pipeable)
--site, -s          GSC property URL (or set GSC_SITE env var)
--format table|json|csv  Output format
--data-state all|final   Data freshness
--verbose, -v       Verbose output

Environment Variables

Variable Description
GSC_SITE Default site URL
GSC_OAUTH_CLIENT_SECRETS_FILE Path to OAuth client secrets
GSC_CREDENTIALS_PATH Path to service account JSON
GSC_SKIP_OAUTH Force service account auth
GSC_DATA_STATE Data freshness: all or final
GSC_CONFIG_DIR Config directory (default: ~/.config/gsc)

License

MIT

About

CLI tool for Google Search Console API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages