seo api

GRATIS CON POSSIBILITร€ DI UPGRADE
Da Serply | Aggiornamento il y a 2 mois | Data
Popolaritร 

9.8 / 10

Latenza

574ms

Livello di servizio

98%

Health Check

N/A

Torna a tutti i tutorial (3)

Using Python to call SEO API

Basic Introduction

The Search API endpoint: https://seo-api.p.rapidapi.com/v1/search/{query
For search the minimum query must have the q parameter. The best module to encode the query parameters is urllib.

The News API endpoint : hhttps://seo-api.p.rapidapi.com/v1/news/{query

This tutorial will be using Python3.5.

Simple Search

This example is a simple search for the keyword โ€œpresident electionโ€. The query should be properly url encoded. So the query will end up being q=president+election

python script:

import urllib
import requests

headers = {
    "x-rapidapi-key": "YOUR_API_KEY",
    "x-rapidapi-host" :"seo-api.p.rapidapi.com"
}

query = {
    "q": "president election"
}

resp = requests.get("https://seo-api.p.rapidapi.com/v1/search/" + urllib.parse.urlencode(query), headers=headers)

results = resp.json()
print(results)

Specify Number Of Results

To specify the number of results to return specify the query parameter num. To return 50 results use num=50. To return 100 use num=100. The default is 10 and the maximum is 100.

Python script to return the top 75 results:

import urllib
import requests

headers = {
    "x-rapidapi-key": "YOUR_API_KEY",
    "x-rapidapi-host" :"seo-api.p.rapidapi.com"
}

query = {
    "q": "president election",
    "num": 75
}

resp = requests.get("hhttps://seo-api.p.rapidapi.com/v1/search/" + urllib.parse.urlencode(query), headers=headers)

results = resp.json()
print(results)

Specify a Language

Use the parameter `lr` to return the results in a specific language. To return results in English use `lr=lang_en`. To return the results in Spanish use `lr=lang_es`.

Python script to return results in French

import urllib
import requests

headers = {
    "x-rapidapi-key": "YOUR_API_KEY",
    "x-rapidapi-host" :"seo-api.p.rapidapi.com"
}

query = {
    "q": "president election",
    "lr": "lang_fr"
}

resp = requests.get("https://seo-api.p.rapidapi.com/v1/search/" + urllib.parse.urlencode(query), headers=headers)

results = resp.json()
print(results)

Specify Country

To limit the search results from a certain location use cr. For example limit the results in the Australia use cr=AU. Or to limit the results in Canada use cr=CA.

Python script to return results in Germany

import urllib
import requests

headers = {
    "x-rapidapi-key": "YOUR_API_KEY",
    "x-rapidapi-host" :"seo-api.p.rapidapi.com"
}

query = {
    "q": "president election",
    "cr": "DE"
}

resp = requests.get("https://seo-api.p.rapidapi.com/v1/search/" + urllib.parse.urlencode(query), headers=headers)

results = resp.json()
print(results)

Combine Multiple Query Parameters

All these parameters can be combined to perform advance queries.

Python script to query top 100 results for the keyword โ€œcoffeeโ€ in Spain

import urllib
import requests

headers = {
    "x-rapidapi-key": "YOUR_API_KEY",
    "x-rapidapi-host" :"seo-api.p.rapidapi.com"
}

query = {
    "q": "coffee",
    "cr": "ES",
    "num": 100
}

resp = requests.get("https://seo-api.p.rapidapi.com/v1/search/" + urllib.parse.urlencode(query), headers=headers)

results = resp.json()
print(results)

OpenAPI V3

The documentation for Googio is also powering this Google Search API.

Ultimate Guide To Google Search Parameters

Use this guide by Moz for more advance Google Search Parameters