When you start typing the keyword search on Google, Google will suggest relevant keywords. There are several reasons, primarily related to research, analysis, SEO, reputation optimization to scrape Google Autocomplete results.

By scraping Google Autocomplete keywords, you can discover popular search queries related to specific keywords or topics, generate ideas for your blog posts, videos, etc. You can have more insights into trending topics, frequently asked questions, and more!

Google Autocomplete keywords are also an excellent source for tracking mentions, sentiments, and brand reputation. For local businesses, they will help to understand the search behavior of users in specific locations.

If you want to scrape real-time keyword suggestions, in different locations and different languages, SerpApi Google Autocomplete offers high-quality APIs for you to support your success. Let's do some searches!


Setting up a SerpApi account

SerpApi offers a free plan for newly created accounts. Head to the sign-up page to register an account and complete your first search with our interactive playground. When you want to do more searches with us, please visit the pricing page.

Once you are familiar with all results, you can utilize SERP APIs using your API Key.

Scrape your first Google Autocomplete results with SerpApi

Head to the Google Autocomplete Results from the documentation on SerpApi for details.

In this tutorial, we will scrape keyword suggestions when searching with the "star" keyword. Will Google suggest "Starbucks" or "star wars"...? The data contains: "value", "relevance", "type" and more. You can also scrape more information with SerpApi.

First, you need to install the SerpApi client library.

pip install google-search-results

Set up the SerpApi credentials and search.

import serpapi
import os, json, csv

params = {
    'api_key': 'YOUR_API_KEY',         # your serpapi api
    'engine': 'google_autocomplete',   # SerpApi search engine	
    'q': 'start'
}

To retrieve Google Autocomplete Results for a given search query, you can use the following code:

client = serpapi.Client()
results = client.search(params)['suggestions']

You can store Google Autocomplete Results JSON data in databases or export them to a CSV file.

import csv

header = ['value', 'relevance', 'type']

with open('google_autocomplete.csv', 'w', encoding='UTF8', newline='') as f:
    writer = csv.writer(f)

    writer.writerow(header)

    for item in results:
        print(item)
        writer.writerow([item.get('value'), item.get('relevance'), item.get('type')])

This example is using Python, but you can also use your all your favorite programming languages likes Ruby, NodeJS, Java, PHP, and more.

If you have any questions, please feel free to contact me.