2makemoney
Regular Member
- Oct 10, 2011
- 467
- 100
One excellent way of tracking SEO progress is by checking the Search engine result pages (SERPs) for your website. But many of the free tools proxies and are slow. I found that RapidAPI provide a simple and easy Google Search API that I can use perform searches.
In this tutorial, I will show you how to perform free SERP searches with a web-based tool and also build a free SERP checker script using Python.
Sign Up
First you need to sign up for a free account on RapidAPI so we can use their Google Search API. The free account allows you 10 free searches/day. https://rapidapi.com/apigeek/api/google-search3/details
Signing up will also give you an API key if you would to use the script to automate the searches.
Manually (Web tool)
You can manually perform searches with the web-based tool (https://rapidapi.com/apigeek/api/google-search3/endpoints). Below is a screenshot highlighting the important parts of the web tool. Simply type your keywords into the q parameter. You can even adjust the country, language, and locality of the search results.
Script (Python 2.7+)
For the lazy you can even automate the searches using their API using languages such as Javascript. Python, Java, and many more. Below is a script that I made with Python to call the Google Search API. Make sure you change the ACCESS_KEY, KEYWORDS, and WEBSITE. Obviously this is a very simple script, but if you know Python you can modify it for your specific use case.
This will search for your website for each of the keywords and print out the ranking. The Google Search API only returns the top 100 results so if it does not find your website within the top 100 results, it will print "Could not find the website in search results.".
Hopefully this helps. Good luck ranking the SERPs!
In this tutorial, I will show you how to perform free SERP searches with a web-based tool and also build a free SERP checker script using Python.
Sign Up
First you need to sign up for a free account on RapidAPI so we can use their Google Search API. The free account allows you 10 free searches/day. https://rapidapi.com/apigeek/api/google-search3/details
Signing up will also give you an API key if you would to use the script to automate the searches.
Manually (Web tool)
You can manually perform searches with the web-based tool (https://rapidapi.com/apigeek/api/google-search3/endpoints). Below is a screenshot highlighting the important parts of the web tool. Simply type your keywords into the q parameter. You can even adjust the country, language, and locality of the search results.
Script (Python 2.7+)
For the lazy you can even automate the searches using their API using languages such as Javascript. Python, Java, and many more. Below is a script that I made with Python to call the Google Search API. Make sure you change the ACCESS_KEY, KEYWORDS, and WEBSITE. Obviously this is a very simple script, but if you know Python you can modify it for your specific use case.
Code:
import urllib
import urllib.parse
import urllib.request
import json
# change this
ACCESS_KEY = "gf4ak6yn7rr6qyfk5l5ox34yldzh44f89z98c6dfhg7pdahf4ffk9fkk2h5di0lugl"
# change to keywords of interest
KEYWORDS = ["how to rank instagram", ''get instagram likes", "how to grow instagram"]
# change this to the website of interest
WEBSITE = "http://website.to.find"
for keyword in KEYWORDS:
country = "US"
language = "lang_en"
data = {
"q": keyword,
"country": country,
"language": language
}
# build the url to make request
urlencoded = urllib.parse.urlencode(data)
url = "https://google-search3.p.rapidapi.com/api/v1/search?" + urlencoded
headers = {
'x-rapidapi-host': "google-search3.p.rapidapi.com",
'x-rapidapi-key': ACCESS_KEY
}
# create a GET request with the url and headers
req = urllib.request.Request(url, headers=headers)
resp = urllib.request.urlopen(req)
# read the results and parse the JSON
content = resp.read()
results = json.loads(content)
found_in_results = False # keep track if we found the website
for rank, result in enumerate(results):
title = result['title']
link = result['link']
if WEBSITE in link:
print("Found website at rank: " + str(rank))
found_in_results = True
if not found_in_results:
print("Could not find the website in search results.")
This will search for your website for each of the keywords and print out the ranking. The Google Search API only returns the top 100 results so if it does not find your website within the top 100 results, it will print "Could not find the website in search results.".
Hopefully this helps. Good luck ranking the SERPs!
Last edited: