This script automatically inspects your new blog posts using Google Search Console’s URL Inspection API. It provides detailed indexing status and helps identify potential issues with your posts. Note: Google has deprecated the programmatic indexing request API, so this script focuses on inspection and monitoring.
http://localhost:8080/http://localhost:8081/http://localhost:9090/http://localhost/ (for fallback)credentials.json in this directoryMake sure your website is verified in Google Search Console.
Install Python Dependencies:
pip install -r requirements.txt
Place Credentials:
credentials.json in this directoryConfigure the Script (optional):
config.json on first runThe easiest way to find unindexed pages is to use the convenience script:
./find_unindexed.sh
This will automatically:
You can also:
# Specify a custom CSV filename
./find_unindexed.sh my_unindexed_pages.csv
# Export all pages (not just unindexed)
./find_unindexed.sh --all
Submit posts modified in the last 7 days:
python submit_posts.py
Submit posts modified in the last 3 days:
python submit_posts.py --mode recent --days 3
Submit posts changed since the last commit:
python submit_posts.py --mode git
Submit posts changed since 5 commits ago:
python submit_posts.py --mode git --since HEAD~5
Submit posts changed since a specific commit:
python submit_posts.py --mode git --since abc1234
python submit_posts.py --mode url --url "https://thinhdanggroup.github.io/your-post-title/"
Inspect all URLs from your sitemap and find unindexed pages:
python submit_posts.py --mode sitemap --filter-unindexed
Export unindexed pages to CSV:
python submit_posts.py --mode sitemap --filter-unindexed --csv-filename unindexed_pages.csv
Inspect all URLs from sitemap (no filtering):
python submit_posts.py --mode sitemap --export-csv
Use a custom sitemap URL:
python submit_posts.py --mode sitemap --sitemap-url "https://example.com/custom-sitemap.xml" --filter-unindexed
Test what would be submitted without actually submitting:
python submit_posts.py --dry-run
Enable detailed logging:
python submit_posts.py --verbose
The script can identify various types of unindexed pages:
--filter-unindexed: Shows all pages that are NOT indexed (including errors)--filter-not-submitted: Shows only pages that are indexable (Verdict: PASS) but not submitted/indexedThe exported CSV includes these fields:
The script uses a config.json file for configuration. Here are the available options:
{
"site_url": "https://thinhdanggroup.github.io/",
"base_url": "https://thinhdanggroup.github.io",
"posts_pattern": "*.md",
"excluded_files": ["README.md", "index.md"],
"rate_limit_delay": 1.0,
"max_urls_per_batch": 10
}
site_url: Your site URL as registered in Google Search Consolebase_url: Base URL for generating post URLsposts_pattern: Glob pattern to match post filesexcluded_files: Files to exclude from submissionrate_limit_delay: Delay between API requests (seconds)max_urls_per_batch: Maximum URLs to submit in one batchOn first run, the script will:
The tokens are saved in token.json and will be automatically refreshed as needed.
python submit_posts.py --mode sitemap --filter-unindexed
python submit_posts.py --mode sitemap --filter-unindexed --csv-filename unindexed_$(date +%Y%m%d).csv
python submit_posts.py --mode url --url "https://thinhdanggroup.github.io/specific-post/" --export-csv
# Check posts updated in last 7 days
python submit_posts.py --mode recent --days 7 --export-csv
# Check only unindexed recent posts
python submit_posts.py --mode recent --days 7 --filter-unindexed --export-csv
Add to your crontab to run daily:
# Submit new posts daily at 9 AM
0 9 * * * cd /path/to/script && python submit_posts.py --mode recent --days 1
Add to your GitHub Actions workflow:
- name: Submit new posts to Google Search Console
run: |
cd script/google_search_console
python submit_posts.py --mode git --since $
env:
GOOGLE_APPLICATION_CREDENTIALS: $
Run after deploying new content:
# In your deployment script
python script/google_search_console/submit_posts.py --mode recent --days 1
“Credentials file not found”
credentials.json exists in the script directory“Permission denied”
“Rate limit exceeded”
rate_limit_delay in config.jsonmax_urls_per_batch“Invalid URL format”
OAuth/Redirect URI Issues
http://localhost:8080/http://localhost:8081/http://localhost:9090/http://localhost/Run with verbose logging to see detailed information:
python submit_posts.py --verbose --dry-run
credentials.json and token.json secure.gitignore to avoid committing to version controlThis script complements your existing IndexNow script (../indexnow/main.py). You can run both:
Consider running both scripts in sequence for maximum search engine coverage.