December 04, 2024
  1. Home
  2. Free Tools
  3. Free Google Index Checker SEO Tool - Create Your Own

Free google index Checker SEO Tool - Create Your Own

Now you can create your own Google Index checker using Python for FREE and that too within 10 to 15 minutes. This free seo tool will help you easily understand if pages on your site are getting indexed by Google or not.

free-google-index-checker-seo-tool-create-your-own

This FREE Python script is designed to search for a list of URLs on Google and check if each URL appears in the search results. It performs the following steps:

Overview of the Code
This Python code performs the following tasks:
  •  Searches Google for URLs: It checks if a list of target URLs appear in Google search results.
  •  Retries Requests: If the search request fails, it retries up to 3 times.
  •  Handles Delays: It introduces delays between requests, making the process more human-like to avoid being blocked.
  •  Writes Results to CSV: It logs the results (whether each URL was found or not) to a CSV file.
free-google-index-checker-seo-tool-create-your-own

Detailed Breakdown of the Code
1. Imports
  • requests: To send HTTP requests and retrieve web pages.
  • BeautifulSoup from bs4: To parse HTML content and extract information.
  • time: For adding delays between requests.
  • csv: To write results to a CSV file.
  • random: To introduce random delays between requests.
  • pandas: To read URLs from a CSV file.
2. Function: check_url_in_search_results()

    Purpose: To check if a specific URL appears in Google search results for a given search query.
    Parameters:
  • search_query: The query to search on Google (e.g., the target URL itself).
  • target_url: The URL we are looking for in the search results.
    Process:
  • A search URL is constructed using the search_query (the query is inserted into the Google search URL).
  • A request is sent to Google, and the response is parsed with BeautifulSoup to extract the search results.
  • It loops through each result, extracts the link, and compares it with the target URL.
  • If a match is found, it returns True and prints that the URL was found.
  • If no match is found after scanning all results, it returns False.
  • The function retries up to 3 times if the request fails (e.g., due to a network issue).
  • A random delay between 30 and 60 seconds is added before retrying.
3. Function: check_multiple_urls()

    Purpose: To check multiple URLs and log whether they are found in the search results.
    Parameters:
  • url_list: A list of URLs to be checked.
  • delay: The base delay between requests (default is 30 seconds).
    Process:
        The function initializes an empty list (results) to store the results of each URL check.
        For each URL in url_list:
  • It calls check_url_in_search_results() to check if the URL appears in Google search results.
  • If found, it adds "Found" to the results list; otherwise, "Not Found".
  • Every 2 URL checks, the program pauses for 30 seconds.
  • A random delay (between delay and delay * 1.5) is added between each request.
  • If no URLs are provided, it prints a message saying "No results to write."
  • If there are results, it writes the URLs and their statuses ("Found" or "Not Found") to a CSV file named results.csv.
4. Function: read_urls_from_csv()
    Purpose: To read URLs from a CSV file.
    Parameters:
        file_path: The path to the CSV file containing the URLs.
    Process:
  • The function reads the CSV file using pandas.read_csv().
  • It assumes that the column containing the URLs is named 'URL' and returns a list of URLs.
5. Main Execution

  • File Path: The path to the CSV file (csv_file_path) is provided.
  • Read URLs: It reads the URLs from the CSV file by calling read_urls_from_csv().
  • Check URLs: The check_multiple_urls() function is called to check if each URL appears in Google search results, with a delay of 20 seconds between each request.
Summary of the Full Process Used in FREE Google Index Checker

    Input: A CSV file containing a list of URLs (url.csv).
    Checking URLs: For each URL in the list, the script:
  • Searches for the URL on Google.
  • Checks if the target URL appears in the search results.
  • If the URL is found, marks it as "Found"; otherwise, "Not Found".
  • Adds a random delay between requests to avoid hitting Google too quickly.
  • After every 2 checks, it pauses for 30 seconds.
    Output: Results are written to a CSV file named results.csv with two columns:
  • URL: The URL that was checked.
  • Status: Whether the URL was "Found" or "Not Found".
  • Retries: If a request fails, it retries up to 3 times with a random delay between retries.
Example Output in results.csv

URL,Status
http://example1.com,Found
http://example2.com,Not Found
http://example3.com,Found


Use Cases
  • SEO Monitoring: Checking if specific URLs appear in search results for certain queries.
  • Web Scraping: Collecting search result data for analysis.
Now, the actual Python Google Index checker tool code follows to help you create your own free seo tool within 10 mins:

import requests
from bs4 import BeautifulSoup
import time
import csv
import random
import pandas as pd

def check_url_in_search_results(search_query, target_url):
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
    }
   
    search_url = 'https://www.google.com/search?q={}'.format(search_query)
   
    for attempt in range(3):  # Retry up to 3 times
        try:
            response = requests.get(search_url, headers=headers)
            if response.status_code == 200:
                soup = BeautifulSoup(response.text, 'html.parser')
                search_results = soup.find_all('div', class_='yuRUbf')
               
                for result in search_results:
                    link = result.find('a')['href']
                    if link == target_url:
                        print('URL found: {}'.format(link))
                        return True
               
                print('URL not found: {}'.format(target_url))
                return False
            else:
                print('Failed to retrieve search results. Status code: {}'.format(response.status_code))
        except requests.RequestException as e:
            print('Error during request: {}'.format(e))
       
        time.sleep(random.uniform(30, 60))  # Wait longer before retrying
   
    return False

def check_multiple_urls(url_list, delay=30):
    results = []  # Initialize the results list
    check_count = 0
   
    for url in url_list:
        search_query = url
        found = check_url_in_search_results(search_query, url)
        results.append([url, 'Found' if found else 'Not Found'])
        check_count += 1
       
        if check_count % 2 == 0:  # Pause after every 2 checks
            print('Pausing for 30 seconds...')
            time.sleep(30)
       
        wait_time = random.uniform(delay, delay * 1.5)  # Random delay between delay and delay*1.5 seconds
        print('Waiting for {:.2f} seconds before the next request...'.format(wait_time))
        time.sleep(wait_time)
   
    # Check if results is empty
    if not results:
        print("No results to write.")
    else:
        # Write results to CSV file
        with open('results.csv', 'w') as csvfile:  # Removed newline='' here
            writer = csv.writer(csvfile)
            writer.writerow(['URL', 'Status'])
            writer.writerows(results)
        print('Results have been written to results.csv')

def read_urls_from_csv(file_path):
    df = pd.read_csv(file_path)  # Read CSV file
    return df['URL'].tolist()  # Assuming the column name is 'URL'

# Read URLs from a CSV file
csv_file_path = r'/home/home/Desktop/google/url.csv'  # Update the path to your CSV file
url_list = read_urls_from_csv(csv_file_path)

# Check all URLs in the list with a delay of 20 seconds between each request
check_multiple_urls(url_list, delay=20)

Summary
  • Create a .csv file and put the urls for which Google index is to be checked in separate rows in first column. Column header will be URLS.
  • Keep the index.py file with the above code in the same folder where the url.csv file is present.
  • In command prompt type - python index.py and press enter.
  • The code will check indexing status for each url and save the output in a results.csv file in the same folder. 


importance