Metadata-Version: 2.4
Name: thedigit-gsc-indexer
Version: 1.0.0
Summary: A bulk Google Search Console Indexing API submission utility
Author-email: Samiullah Awan <business@thedigithq.com>
Project-URL: Homepage, https://thedigithq.com
Project-URL: Bug Tracker, https://github.com/Samiullah-Awan/gsc-fast-indexer/issues
Project-URL: Source Code, https://github.com/Samiullah-Awan/gsc-fast-indexer
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: google-auth>=2.0.0
Requires-Dist: google-auth-oauthlib>=1.0.0
Requires-Dist: google-api-python-client>=2.0.0
Requires-Dist: requests>=2.28.0
Dynamic: license-file

# GSC Fast Indexer CLI 🚀

A lightweight, automated Python command-line tool to submit URLs to the **Google Search Console Indexing API** in bulk. Easily index single URLs, URLs listed in text files, or extract and crawl directly from online or local XML sitemaps.

This tool bypasses the standard slow crawl cycle by directly notifying Google's Indexing API of new or updated pages, reducing indexing times from weeks to minutes.

---

## 🛠️ Maintained & Funded By

This project is created and maintained by **[The DIGIT](https://thedigithq.com)**.

We are a precision-engineered digital product agency specializing in:
*   **SaaS Product Development:** Building responsive, fast, and scalable full-stack web applications.
*   **Autonomous AI Automation:** Implementing custom LLM-powered workflows to optimize business processes.
*   **Technical SEO:** Delivering advanced, analytics-driven site audits and performance optimizations.

Need help building your next SaaS or automating your indexing? Let's talk at **[thedigithq.com](https://thedigithq.com)** or reach us at `business@thedigithq.com`.

---

## Features
*   **Bulk Sitemap Parsing:** Read and parse all `<loc>` elements from online/local `sitemap.xml` feeds.
*   **Batch File Submissions:** Feed a text file of URLs to be submitted sequentially.
*   **Action Types:** Supports `URL_UPDATED` (request crawling) and `URL_DELETED` (request removal).
*   **Error Guidance:** Detailed output troubleshooting permissions errors (a common blocker with GSC Service Accounts).

---

## Prerequisites & Installation

### 1. Install Dependencies
Ensure you have Python 3 installed. Clone this repository, navigate to the directory, and install the requirements:

```bash
pip install -r requirements.txt
```

### 2. Set Up Google Indexing API Credentials (Required)
Google restricts access to its Indexing API to verified owners. Follow these steps to set up credentials:

1.  **Create a Google Cloud Project:**
    Go to the [Google Cloud Console](https://console.cloud.google.com/), and create a new project.
2.  **Enable the API:**
    Search for **Google Indexing API** and click **Enable**.
3.  **Create a Service Account:**
    *   Navigate to **IAM & Admin** > **Service Accounts**.
    *   Click **Create Service Account** (grant it a role like "Viewer" or leave it blank).
    *   Copy the email address of the new Service Account (it looks like `your-account@your-project.iam.gserviceaccount.com`).
4.  **Download JSON Key:**
    *   Click on the newly created Service Account.
    *   Go to the **Keys** tab > **Add Key** > **Create new key**.
    *   Choose **JSON** format and download the file.
    *   Save it in the root folder of this project as `credentials.json`.
5.  **Delegate GSC Ownership (Critical Step):**
    *   Open your [Google Search Console](https://search.google.com/search-console).
    *   Select your site property.
    *   Go to **Settings** > **Users and permissions**.
    *   Click **Add User**.
    *   Paste the Service Account email address as the user, and set the Permission Level to **Owner** (Owner permissions are required to call the Indexing API).

---

## Usage

Run the script by choosing one of the three input types:

### Option A: Submit a Single URL
```bash
python indexer.py --url "https://thedigithq.com/blog/ai-workflows"
```

### Option B: Submit URLs From a Sitemap
```bash
python indexer.py --sitemap "https://thedigithq.com/sitemap.xml"
```

### Option C: Submit URLs From a Local File
Create a `urls.txt` with one URL per line:
```text
https://thedigithq.com/services
https://thedigithq.com/about
```
Then run:
```bash
python indexer.py --file urls.txt
```

### Options and Flags
*   `-c`, `--credentials`: Path to the service account credentials JSON (default: `credentials.json`).
*   `-t`, `--type`: Action type, either `URL_UPDATED` or `URL_DELETED` (default: `URL_UPDATED`).

---

## License
Licensed under the [MIT License](LICENSE). Feel free to fork, modify, and use this tool in your own CI/CD pipelines.

---

*Need custom technical SEO workflows built? Partner with **[The DIGIT](https://thedigithq.com)**.*
