Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gemini Scraper

Scrapeless Gemini Scraper - collect Google Gemini answers with one API call

Try Scrapeless Blog License

Send a prompt to Google Gemini and get back a structured answer — Markdown text, the raw answer body, and every source Gemini cited — through the Scrapeless LLM Chat Scraper API. One POST request. No browser fleet, no session juggling, no selector maintenance.

Use it to track how Gemini answers questions about your brand, compare answers across regions, audit which domains Gemini cites, or feed AI answers into a GEO / AI-search-visibility dashboard.

Quick start

curl 'https://api.scrapeless.com/api/v2/scraper/execute' \
  --header 'Content-Type: application/json' \
  --header 'x-api-token: YOUR_API_TOKEN' \
  --data '{
    "actor": "scraper.gemini",
    "input": {
      "prompt": "Recommended attractions in New York",
      "country": "US"
    }
  }'

To receive the result asynchronously instead of waiting on the response, add a webhook object:

"webhook": { "url": "https://www.your-webhook.com" }

Request parameters

The body has three top-level fields: actor (always scraper.gemini), input, and an optional webhook.

Parameter (input.*) Type Required Description
prompt string Yes The prompt to send to Gemini.
country string Yes Country / region code (e.g. US, JP, DE) the prompt is sent from.

scraper.gemini takes exactly these two inputs. Unrecognised keys are accepted and silently dropped rather than rejected — we sent web_search: true and the response came back byte-identical in shape, with no search flag echoed anywhere. If you are porting a scraper.chatgpt payload, its web_search and shopping flags do nothing here. Do not read a 200 as confirmation that a parameter took effect.

Response

{
  "status": "success",
  "task_id": "af361307-3dac-4652-9529-65c3b7130c37",
  "task_result": {
    "prompt": "Recommended attractions in New York",
    "result_text": "...Markdown answer with ([Source][1]) style references...",
    "rawtext": "...the same answer without reference markers...",
    "citations": [
      {
        "title": "15 Fun Things To Do In NYC For First-Timers",
        "url": "https://theworldtravelguy.com/nyc-things-to-do/",
        "website_name": "The World Travel Guy",
        "snippet": "...",
        "highlights": ["..."],
        "favicon": "https://..."
      }
    ],
    "related_queries": null
  }
}

A complete, unedited response from a real run is committed at results/gemini-sample.json — see results/TRIMMED.md.

task_result fields

Field Type Description
prompt string The prompt you submitted, echoed back.
result_text string The Markdown answer, with inline ([Name][n]) reference markers.
rawtext string The answer body without reference markers. Useful when you want prose, not citations.
citations array Sources Gemini referenced. Conditional — absent or empty when the answer cites nothing.
citations[].title string Title of the cited page.
citations[].url string URL of the cited page. Often a #:~:text= scroll-to-text fragment rather than a bare URL.
citations[].website_name string Human-readable site name.
citations[].snippet string Snippet of the cited passage.
citations[].highlights array Highlighted fragments within the source.
citations[].favicon string Favicon URL.
related_queries array | null Follow-up queries. Frequently null — see below.

Field notes from real runs

These are behaviours we hit while testing this actor, not doc paraphrase. They are the things that break naive parsers.

  • related_queries is often null, not []. It came back null on every run we captured. Code that does for q in result["related_queries"] crashes rather than skipping. Use result.get("related_queries") or [].
  • citations[].url is usually a text-fragment URL. Expect https://example.com/page/#:~:text=quoted%20passage rather than https://example.com/page/. Strip everything from #:~:text= if you are deduplicating by URL, or the same page will count many times — one of our runs returned 15 citations covering 8 distinct pages.
  • result_text can contain inline <Image .../> tags with an internal image_agent_tag_… src that is not a fetchable URL. Strip them before rendering the Markdown.
  • A cold call takes roughly 15 seconds. Set client timeouts well above the default; the language examples here use 180s.
  • Field presence is per-response, not per-actor. Treat every array and object as conditional and coalesce before iterating.

Code examples

Ready-to-run examples live in examples/:

Language File Run
Python example.py pip install requests && python example.py
Node.js example.js node example.js (Node 18+)
Go example.go go run example.go
Java Example.java java Example.java (Java 11+)
PHP example.php php example.php

All of them read the token from the environment:

export SCRAPELESS_API_TOKEN="your_api_token"

Copy .env.example to .env if you prefer a file. Never commit the real token.

Use cases

AI search visibility (GEO). Run your category prompts on a schedule and record whether Gemini names you, and which competitor domains it cites when it does not.

Citation auditing. citations[] gives you the exact sources behind an answer — the input for "which of our pages does Gemini actually trust?"

Regional comparison. The same prompt with different country values shows how the answer and its sources change by market.

Cross-engine benchmarking. Pair this with chatgpt-scraper and perplexity-scraper — same envelope, same auth, so one collector can cover all three engines.

FAQ

What is the Gemini Scraper? A Scrapeless LLM Chat Scraper actor (scraper.gemini) that submits a prompt to Google Gemini and returns the answer as structured JSON with citations.

Do I need a browser or proxy pool? No. Your side is one HTTP POST; Scrapeless runs the collection.

Can I get results asynchronously? Yes — add a webhook object with your callback URL.

Why is related_queries null? Gemini does not always return follow-up suggestions. The field is present but null, so guard it.

Is this legal? You are responsible for your own use. Check applicable law, platform terms, and your organisation's data policy, and do not collect private or personal data.

Verification

Everything documented above was captured live on 2026-09-01 against POST https://api.scrapeless.com/api/v2/scraper/execute.

Check Result
scraper.gemini live call HTTP 200 in 15.5s, status: success
task_result keys observed citations, prompt, rawtext, related_queries, result_text
citations returned 15 entries, 8 unique pages after stripping text fragments
related_queries null on every run
examples/example.py run live, returned a real answer + citations
examples/example.php run live, returned a real answer + citations
examples/example.js syntax-checked (node --check)
examples/Example.java compiled (javac)
examples/example.go not run — no Go toolchain on the verification box

Learn more

Contact

  • Discord
  • Telegram
  • For repo issues or improvements, open an issue or pull request.

About

Collect Google Gemini answers, Markdown output, and source citations through the Scrapeless LLM Chat Scraper API for AI search visibility and GEO workflows.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors