Automate SERP processing for keywords in bulk with Python and Google Colab

When working on SEO analysis, performing bulk SERP checks helps me to analyse multiple keywords at once and give me insights into who are the top players in a particular niche.

However, doing this manually is time-consuming and annoying (who wants to go back and forth to check each keyword in a keyword research tool). Thanks to Python and Google Colab, we can automate this process. 

This post explains how to bulk check keywords and download the SERP report using Python and Google Colab.

Using Google Colab and Python to bulk check SERPs

Step 1. Open the Google Colab Notebook

Open the pre-written Python script in Google Colab.

Once the notebook opens, you’ll see the code blocks with explanations and Python code to run.

Step 2. Update the list of keywords in the script

Define your list of keywords directly in the Python script. In the script, you’ll find a list variable where you can add all the keywords you want to check.

Here’s an example of how you can update the list of keywords:

# Define your list of keywords

keywords = ["what is keyword research", "keyword research tools", "how to do keyword research"]

Step 3. Run the entire script

Once you’ve updated the list of keywords, you can click Runtime at the top of the page and select Run All. The script will automatically save and download the SERP results to a CSV file.

If you don’t need to download the csv file, you can also manually click the Play button next to the first code block to see SERP report for multiple keywords.

What are the limitations to using Google Colab to bulk check SERP

Google Colab is a free, cloud-based platform that allows you to write and execute Python code without setting up a local environment. However, it is not a perfect solution to bulk check your SERP as it comes with several limitations:

  • Rate-Limiting: When you send too many requests in a short time, Google may temporarily block your IP address. Implement random delays between requests and use it with cautions.
  • No personalised and localised results: The results may be specific to the IP location of the Colab servers (which can be anywhere in the world), not the geographic location you’re interested in.
  • No SERP features: This script doesn’t scrape any SERP features, such as People Also Asked, maps or rich results (e.g. star ratings)
  • If you’re scraping hundreds of keywords, processing them one at a time can take a long time.
  • Each Colab session is temporary, so any files or datasets uploaded will be lost when the session terminates unless you explicitly download or store them on Google Drive.

While Colab can be a good starting point for small-scale scraping, this is only a temporary solution when I need to bulk check a list of keywords quickly. If you need to access more keywords or get localized data, consider using  Google Custom Search JSON API or other API to get a more accurate result.

Conclusion

Using Google Colab and Python, you can easily automate the process of checking the SERP for a list of keywords. This method is perfect for small to medium-sized SEO projects or for experimenting with SERP data in a lightweight environment. 

If you’re working on larger projects, you might need more advanced tools or APIs. But for quick and efficient bulk checking, Google Colab combined with Python is a powerful solution that anyone can use for free (and without signing up for additional service)!

Aubrey Yung

Aubrey Yung

Aubrey is an SEO Consultant with 5+ years of B2B and B2C marketing experience.