Skip to main content

gemini-scraper

A Python client for the Gemini API endpoint on ScrapingBee. Send a prompt to Google Gemini, get back the answer as text, as markdown, and with citations when Gemini attaches them. No headless browser to run, no Google account to manage.

Verified against the live endpoint on 2026-08-25: GET https://app.scrapingbee.com/api/v1/gemini, 15 credits per successful call.

Install

pip install gemini-scraper

Python 3.8+ and requests. You need a ScrapingBee key from app.scrapingbee.com, which starts with 1,000 free credits.

One prompt

from gemini_scraper import GeminiScraper

scraper = GeminiScraper("YOUR-API-KEY")
answer = scraper.ask("Best programming languages for data science")

print(answer.markdown)
print(answer.citations)
print(answer.cost, answer.request_id)

What the Gemini scraper returns

The endpoint answers with five fields. These are the real keys observed on a live call, not a guess at the shape:

Field Property What it holds
results_text answer.text The answer as plain text
results_markdown answer.markdown The same answer with formatting preserved
citations answer.citations Sources Gemini attached, when it attaches any
full_html answer.html Rendered HTML of the answer pane
prompt answer.prompt The prompt echoed back

Citations are returned when the prompt produces them. Treat the list as best effort rather than a guarantee, and check len(answer.citations) before relying on it.

Localising an answer

Gemini answers differently depending on where the request comes from. Anything involving pricing, availability, regulation or local providers is worth running per market:

for market in ["us", "gb", "de", "fr"]:
    answer = scraper.ask("best project management software", country_code=market)
    print(market, len(answer.citations), answer.text[:120])

Running a prompt set

Brand visibility work means the same prompt list on a schedule. ask_many keeps going when a single prompt fails, returning None in that slot rather than losing the batch:

prompts = [
    "best web scraping api",
    "how do I scrape a javascript heavy site",
    "cheapest way to collect serp data",
]

for prompt, answer in zip(prompts, scraper.ask_many(prompts, country_code="us")):
    if answer is None:
        print("failed:", prompt)
        continue
    print(prompt, "->", answer.text[:100])

At 15 credits per call, a 100-prompt set costs 1,500 credits per run. Check the balance first:

print(scraper.usage())
# {'max_api_credit': ..., 'used_api_credit': ..., 'max_concurrency': ..., 'current_concurrency': ...}

usage() is free and capped at 6 calls per minute.

Tagging requests

tag attaches your own identifier so a call can be found later in the dashboard, which matters when several jobs share one key:

scraper.ask("best crm for small teams", tag="visibility-run-2026-08")

Errors

GeminiScraperError carries status_code, body and request_id. Quote the request id to support. HTTP 500 responses are not charged credits, so a retry costs nothing:

from gemini_scraper import GeminiScraper, GeminiScraperError

try:
    answer = scraper.ask("...")
except GeminiScraperError as error:
    print(error.status_code, error.request_id)

Cost

Call Credits
One Gemini prompt 15
usage() 0
Failed request (HTTP 500) 0

Plan tiers at scrapingbee.com/pricing.

Related scrapers

The same account also reaches ChatGPT, Google search, Google AI Mode, Google News and Perplexity, which is the usual set for tracking how a brand shows up across AI answers.

Scope

Public, pre-login content only. Scraping behind login credentials is prohibited by the ScrapingBee terms. Keep your API key out of shared environments, including AI coding assistants.

More: Gemini feature page . documentation . code in eight languages

MIT licensed.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gemini_scraper-0.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gemini_scraper-0.1.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file gemini_scraper-0.1.0.tar.gz.

File metadata

  • Download URL: gemini_scraper-0.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for gemini_scraper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ae81f3f851f193baf22ea4a501825151386befdcc5181e719919f0093348e898
MD5 4fcc2ffccea8b005245fb1e1ff212b3c
BLAKE2b-256 1be7f55fe127b61e97bf7e864a4947077bbe31420ed5d252b21d6d61e599eaf9

See more details on using hashes here.

File details

Details for the file gemini_scraper-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gemini_scraper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for gemini_scraper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8973152d46a2537b3dfc83ac9759ab7a84e90384282637c18180e1470f7d732d
MD5 9f4b855341328df407059d091d6311df
BLAKE2b-256 a6030d728ad3b1e56deb151f64c55ada68ed7fd889894bfb177f8c21b062508a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page