Google SERP API: How to Scrape Google Search Results with Talordata
Learn how to scrape Google Search results with Talordata SERP API. Use Python to collect organic results, titles, URLs, snippets, ranking positions, and export the data to CSV.
Google Search results are useful when you need fresh data for SEO research, competitor tracking, market monitoring, or AI workflows.
You may want to collect:
-
organic result titles
-
URLs
-
snippets
-
ranking positions
-
domains
-
related questions
-
ads
-
local or shopping results
-
SERP features
You can try to scrape Google manually with browser automation, but that usually means handling page rendering, changing layouts, blocks, CAPTCHA challenges, and parsing logic.
A Google SERP API gives you a cleaner workflow. You send a query, location, language, and device. The API returns structured search data that your app can store, analyze, or pass into an AI workflow.
Talordata SERP API is designed to retrieve real-time structured search results from Google and other major search engines, with JSON / HTML response formats and geo-targeted SERP data. It also supports Google, Bing, Yandex, and DuckDuckGo from one API layer.
What We Will Build
In this tutorial, we will create a small Python script that:
Search query
→ Talordata SERP API
→ Google organic results
→ Clean title, URL, snippet, domain, position
→ Export results to CSV
This is useful for:
-
SEO rank tracking
-
competitor monitoring
-
content research
-
AI agent source discovery
-
RAG workflows
-
market research dashboards
-
search result archiving
Step 1: Prepare Your API Key
Create a Talordata account and get your SERP API key from the dashboard.
Talordata’s product page says users can start with 1,000 free API responses, and its SERP API pricing is response-based.
Store your API key as an environment variable.
export TALORDATA_API_KEY="your_api_key_here"
On Windows PowerShell:
$env:TALORDATA_API_KEY="your_api_key_here"
Install the Python package:
pip install requests
Step 2: Send a Google SERP Request
Talordata examples use a SERP endpoint with parameters such as engine, q, location, and num for search workflows. Its Google SERP examples also describe common request parameters like q, gl, hl, device, num, and start.
Here is a basic Python request:
import os
import requests
TALORDATA_API_KEY = os.getenv("TALORDATA_API_KEY")
TALORDATA_ENDPOINT = "https://api.talordata.com/v1/serp"
def search_google(query, location="United States", language="en", country="us"):
if not TALORDATA_API_KEY:
raise RuntimeError("Missing TALORDATA_API_KEY environment variable")
payload = {
"engine": "google",
"q": query,
"location": location,
"hl": language,
"gl": country,
"num": 10
}
headers = {
"Authorization": f"Bearer {TALORDATA_API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(
TALORDATA_ENDPOINT,
json=payload,
headers=headers,
timeout=30
)
response.raise_for_status()
return response.json()
The exact endpoint or authentication method may depend on your Talordata dashboard configuration. If your dashboard shows a different endpoint, use the endpoint from your account.
Step 3: Extract Organic Results
Google SERP responses can include many sections: organic results, ads, related questions, maps, knowledge panels, and more.
For a simple tutorial, start with organic results.
from urllib.parse import urlparse
def clean_text(value):
if not value:
return ""
return " ".join(str(value).split())
def get_domain(url):
if not url:
return ""
parsed = urlparse(url)
return parsed.netloc.replace("www.", "")
def extract_organic_results(serp_json, query):
organic_results = serp_json.get("organic_results", [])
rows = []
for index, item in enumerate(organic_results, start=1):
url = item.get("link") or item.get("url") or ""
rows.append({
"query": query,
"position": item.get("position") or item.get("rank") or index,
"title": clean_text(item.get("title")),
"url": url,
"domain": get_domain(url),
"snippet": clean_text(item.get("snippet") or item.get("description"))
})
return rows
Talordata’s SEO use case page describes organic search data as including ranking positions, titles, URLs, snippets, and ranking changes, which are the core fields most SEO workflows need.
Step 4: Export Results to CSV
CSV is a good format for quick checks, content research, and simple rank tracking.
import csv
CSV_COLUMNS = [
"query",
"position",
"title",
"url",
"domain",
"snippet"
]
def export_to_csv(rows, filename="google_serp_results.csv"):
if not rows:
print("No organic results found.")
return
with open(filename, mode="w", newline="", encoding="utf-8") as file:
writer = csv.DictWriter(file, fieldnames=CSV_COLUMNS)
writer.writeheader()
writer.writerows(rows)
print(f"Exported {len(rows)} results to {filename}")
Complete Python Example
import os
import csv
import requests
from urllib.parse import urlparse
TALORDATA_API_KEY = os.getenv("TALORDATA_API_KEY")
TALORDATA_ENDPOINT = "https://api.talordata.com/v1/serp"
CSV_COLUMNS = [
"query",
"position",
"title",
"url",
"domain",
"snippet"
]
def clean_text(value):
if not value:
return ""
return " ".join(str(value).split())
def get_domain(url):
if not url:
return ""
parsed = urlparse(url)
return parsed.netloc.replace("www.", "")
def search_google(query, location="United States", language="en", country="us"):
if not TALORDATA_API_KEY:
raise RuntimeError("Missing TALORDATA_API_KEY environment variable")
payload = {
"engine": "google",
"q": query,
"location": location,
"hl": language,
"gl": country,
"num": 10
}
headers = {
"Authorization": f"Bearer {TALORDATA_API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(
TALORDATA_ENDPOINT,
json=payload,
headers=headers,
timeout=30
)
response.raise_for_status()
return response.json()
def extract_organic_results(serp_json, query):
organic_results = serp_json.get("organic_results", [])
rows = []
for index, item in enumerate(organic_results, start=1):
url = item.get("link") or item.get("url") or ""
rows.append({
"query": query,
"position": item.get("position") or item.get("rank") or index,
"title": clean_text(item.get("title")),
"url": url,
"domain": get_domain(url),
"snippet": clean_text(item.get("snippet") or item.get("description"))
})
return rows
def export_to_csv(rows, filename="google_serp_results.csv"):
if not rows:
print("No organic results found.")
return
with open(filename, mode="w", newline="", encoding="utf-8") as file:
writer = csv.DictWriter(file, fieldnames=CSV_COLUMNS)
writer.writeheader()
writer.writerows(rows)
print(f"Exported {len(rows)} results to {filename}")
if __name__ == "__main__":
query = "best project management software"
serp_json = search_google(
query=query,
location="United States",
language="en",
country="us"
)
rows = extract_organic_results(serp_json, query)
export_to_csv(rows)
After running the script, you should get:
google_serp_results.csv
Example Output
The CSV may look like this:
query,position,title,url,domain,snippet
best project management software,1,Example Title,https://example.com,example.com,Short search snippet...
best project management software,2,Another Result,https://example.org,example.org,Another snippet...
From here, you can send the results to a database, Google Sheets, Notion, Slack, or an AI workflow.
Useful Parameters to Adjust
For most Google SERP scraping workflows, these parameters matter most:
|
Parameter |
Meaning |
|
|
Search engine, such as |
|
|
Search query |
|
|
Target location |
|
|
Country or market |
|
|
Language |
|
|
Desktop or mobile |
|
|
Number of results |
|
|
Pagination offset |
Use location, gl, and hl carefully. Google results can change significantly by country, city, language, and device.
Common Use Cases
SEO rank tracking
Run the same keyword list every day or week. Store the ranking position, domain, title, URL, and snippet. Then compare changes over time.
Competitor monitoring
Track which competitor domains appear in the top 10. You can also monitor changes in titles, snippets, and landing pages.
Content research
Collect top-ranking pages for a topic. Group results by page type, domain, title pattern, and search intent.
AI and RAG workflows
Use Google SERP results as a discovery layer. The SERP API finds current URLs and snippets. Your app can then fetch full pages, chunk content, and pass selected text to an LLM.
Talordata’s product page lists AI search and agent integration as a use case for real-time SERP data, including RAG pipelines and AI agents.
Best Practices
Keep raw responses during development. They help you debug missing fields.
Normalize before storing. Do not build dashboards directly on raw API responses.
Save timestamps. Search results change over time, so every row should include a collection time in production.
Separate discovery from page extraction. SERP data tells you what ranks. Full-page scraping tells you what each page says.
Follow compliance rules. Talordata describes its SERP API as designed around publicly available search-result data, while noting that users should ensure their own use complies with applicable laws, search engine terms, and internal compliance rules.
FAQ
Can I scrape Google Search results with Python?
Yes. You can use Python with a Google SERP API to send a query and receive structured results. With Talordata, you can request Google results and extract organic titles, URLs, snippets, and ranking positions.
Why use Talordata instead of scraping Google manually?
Manual scraping usually requires handling page rendering, anti-bot checks, changing HTML, and parsing. Talordata returns structured SERP data so you can focus on analysis and automation.
What data can I collect from Google SERP results?
Common fields include title, URL, snippet, ranking position, domain, ads, related questions, local results, and other SERP features depending on the search type.
Can I export Google SERP API results to CSV?
Yes. After receiving JSON from the SERP API, you can normalize the organic results and write them to CSV with Python’s built-in csv module.
Can I use this for AI agents or RAG?
Yes. Google SERP data can work as a live discovery layer for AI agents and RAG workflows. Use SERP results to find current URLs, then fetch and process page content when deeper evidence is needed.