Gemini Scraper API: Capture Google Gemini Answers as Data
Web Data Collection Specialist
TL;DR:
- The Gemini Scraper captures Google Gemini's answer as structured data. Send a prompt to
scraper.gemini; get back the answer text plus the citations Gemini grounded it on. - It is a two-call async flow. POST the prompt to create a task, then GET the result by
task_id— in a live run the answer came back in about 12 seconds. - Citations come structured, not scraped out of HTML. Each carries
title,url,website_name,snippet,favicon, and the highlighted passages Gemini used. - Localize with a country code. The
countryfield shapes the answer to a region, the same way a user there would see it. - This is how you monitor brand visibility in AI answers. Ask Gemini the questions your customers ask and read which sources it cites.
- Free to start. New Scrapeless accounts include free Scraper API usage — sign up at app.scrapeless.com.
Introduction: read what Gemini actually answers
AI answer engines now sit between users and the open web. When someone asks Google Gemini for "the best proxy service" or "things to do in New York," the answer — and the sources it cites — shape what that user believes before they click anything. For brand monitoring, competitive research, and answer-engine optimization, the question is no longer "where do I rank on Google" but "what does Gemini say, and who does it cite."
The Scrapeless Gemini Scraper answers that programmatically. You send a prompt to the scraper.gemini actor and get back the answer text plus the structured citations behind it. This guide covers the request shape, a first curl, the response schema, a Python integration, and how to use it — every request and response below was captured against the live API.
What you can do with it
- Capture Gemini's answer text — the full response as CommonMark-style Markdown, ready to store or analyze.
- Read the citations — the sources Gemini grounded the answer on, each with title, URL, and the passage used.
- Track brand mentions in AI answers — ask the questions your buyers ask and see whether you appear.
- Localize by region — set
countryto see the answer as a user in that market would. - Feed a monitoring pipeline — run the same prompts on a schedule and diff the sources over time.
Why the Scrapeless Gemini Scraper
The Gemini Scraper is part of the Scrapeless LLM Chat Scraper line, the managed way to read AI-engine answers as data. For Gemini specifically, it brings:
- A single request contract — send a prompt, get the answer and its citations; no browser to drive.
- Structured citations — sources come back as fields, not markup you have to parse.
- Residential proxies in 195+ countries — answers are fetched through clean, region-appropriate egress.
- Localization by country — one field shapes the answer to a market.
Get your API key on the free plan at app.scrapeless.com.
Prerequisites
- A Scrapeless account and API key — sign up at app.scrapeless.com
curlfor the first request, and Python 3.10+ for the integration- Basic familiarity with HTTP and JSON
How the Gemini Scraper works
The flow is two calls: create a task, then fetch its result.
Request parameters
| Field | Where | Meaning |
|---|---|---|
actor |
top level | scraper.gemini |
input.prompt |
input | the question to ask Gemini |
input.country |
input | ISO country code to localize the answer |
Auth is the x-api-token header on both calls.
Quick capture with curl
Create the task:
bash
curl -X POST https://api.scrapeless.com/api/v2/scraper/request \
-H "x-api-token: ${SCRAPELESS_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"actor": "scraper.gemini",
"input": { "prompt": "Recommended attractions in New York", "country": "US" }
}'
# { "status": "pending", "task_id": "3886db31-…" }
Then fetch the result by task_id:
bash
curl -X GET https://api.scrapeless.com/api/v2/scraper/result/{task_id} \
-H "x-api-token: ${SCRAPELESS_API_KEY}"
Response envelope
Once status is success, the answer and citations are in task_result:
json
// illustrative sample — field shape is exact (captured live); values abbreviated
{
"status": "success",
"task_result": {
"prompt": "Recommended attractions in New York",
"result_text": "New York City is a beautiful chaos of culture, history…",
"citations": [
{
"title": "20 Best Things to Do in NYC",
"url": "https://example.com/nyc",
"website_name": "Example Travel",
"snippet": "From the Statue of Liberty to…",
"favicon": "https://example.com/favicon.ico",
"highlights": ["Statue of Liberty", "Central Park"]
}
]
}
}
In a live run this returned in about 12 seconds with 15 citations, each carrying the six fields above.
Integrating the API in Python
Create the task, poll until it's done, and read the answer:
python
import os
import time
import requests
API_KEY = os.environ["SCRAPELESS_API_KEY"]
BASE = "https://api.scrapeless.com"
HEADERS = {"x-api-token": API_KEY, "Content-Type": "application/json"}
def ask_gemini(prompt: str, country: str = "US") -> dict:
created = requests.post(
f"{BASE}/api/v2/scraper/request",
headers=HEADERS,
json={"actor": "scraper.gemini", "input": {"prompt": prompt, "country": country}},
timeout=60,
)
task_id = created.json()["task_id"]
for _ in range(30):
time.sleep(3)
got = requests.get(f"{BASE}/api/v2/scraper/result/{task_id}", headers=HEADERS, timeout=60)
data = got.json()
if data.get("status") in ("success", "failed"):
return data
raise TimeoutError("result not ready in time")
result = ask_gemini("Recommended attractions in New York")
answer = result["task_result"]
print(answer["result_text"])
for c in answer["citations"]:
print("-", c["website_name"], c["url"])
Get your API key on the free plan: app.scrapeless.com
How to avoid common problems
- A field that isn't present is null, not an error. Not every answer carries
highlightsor afavicon; treat each citation field as optional and guard for its absence. - Fetch results promptly. The result is retrieved by
task_id; poll shortly after creating the task rather than long after, and prefer a short poll interval to reading it much later. - Pin the country to the market you're studying. The
countryfield changes the answer; keep it fixed per monitoring run so results are comparable over time. - Answers vary between runs. Gemini's wording shifts run to run, so compare the citation sources over time, not the exact prose — the way answer engines surface pages is described in Google's own AI-features guidance for the web, and the HTTP contract you're calling follows the HTTP semantics specification.
Conclusion: your brand, as Gemini sees it
The Gemini Scraper turns an AI answer into data you can track: the response text and the exact sources behind it, in one two-call flow. Run the prompts your customers ask, store the citations, and watch how your visibility in Gemini's answers changes over time. Pair it with the other engines in the Universal Scraping API line, read up on why answer engines changed search, and the docs cover every field.
Ready to Build Your AI-Powered Data Pipeline?
Join our community to claim a free plan and connect with developers monitoring AI answers: Discord · Telegram.
Sign up at app.scrapeless.com for free Scraper API usage, and see pricing for scale.
FAQ
Q: What does the Gemini Scraper return?
The answer text as Markdown (result_text) plus a citations array — each citation has title, url, website_name, snippet, favicon, and the highlights Gemini used. In a live run one prompt returned 15 citations.
Q: Is it synchronous?
No. You POST the prompt to create a task and GET the result by task_id. In a live run the answer was ready in about 12 seconds.
Q: Can I localize the answer?
Yes — set input.country to an ISO code. The answer is shaped to that market, so keep it fixed when you compare results over time.
Q: Why do the answers change between runs?
Generative answers vary in wording run to run. For monitoring, track the citation sources and whether your brand appears, not the exact prose.
Q: Do I need a proxy?
No. Egress is handled inside the actor through residential IPs; you only send the prompt and country.
At Scrapeless, we only access publicly available data while strictly complying with applicable laws, regulations, and website privacy policies. The content in this blog is for demonstration purposes only and does not involve any illegal or infringing activities. We make no guarantees and disclaim all liability for the use of information from this blog or third-party links. Before engaging in any scraping activities, consult your legal advisor and review the target website's terms of service or obtain the necessary permissions.



