Pricing
from $0.60 / actor start
Pricing
from $0.60 / actor start
Rating
0.0
(0)
Developer
Actor stats
0
Bookmarked
3
Total users
1
Monthly active users
11 days ago
Last modified
Categories
Share
Gemini Scraper โ Apify Actor
Scrapes text responses from Google Gemini by replaying authenticated browser requests. Accepts a list of queries, sends each to Gemini, and saves the full AI-generated response to an Apify dataset.
โ ๏ธ This actor uses Gemini's internal browser API, not the official Gemini REST API. Session cookies are hardcoded in the source and must be refreshed in the code when they expire (~24 hours).
Features
- Send multiple queries in a single run
- Only input required: a list of queries
- Full response text extracted from Gemini's streaming protocol
- Per-query error isolation โ one failure does not stop the rest
- Dataset output with structured fields:
query,response,error,scrapedAt
Input
Only one field is required.
| Field | Type | Required | Description |
|---|---|---|---|
queries | string[] | โ | One or more queries to send to Gemini |
Example Input JSON
{"queries":["best smartphones 2026","python vs javascript for web development","how does quantum computing work"]}
Output
Each query produces one record in the default dataset.
Success Record
{"query":"best smartphones 2026","response":"The top smartphones in 2026 include...","error":null,"scrapedAt":"2026-06-19T10:30:00.000Z"}
Failure Record
{"query":"best smartphones 2026","response":null,"error":"HTTPError: 403 Forbidden","scrapedAt":"2026-06-19T10:30:00.000Z"}
When Cookies Expire
All session values (cookies, headers, params) are hardcoded at the top of
src/main.py under COOKIES, HEADERS, PARAMS, and SESSION_ID.
When requests start returning 401 or 403, refresh the values:
Step-by-step
- Open https://gemini.google.com in Chrome while signed in.
- Press
F12โ Network tab. - Send any message in Gemini.
- Filter by
StreamGenerateโ click the request. - Go to Headers โ Request Headers โ copy the
Cookieheader. - Extract
__Secure-STRP,NID, andCOMPASSvalues. - Update
COOKIESinsrc/main.py. - From the same request's Query String Parameters, copy
blandf.sid. - Update
PARAMSinsrc/main.py. - Redeploy the actor.
Project Structure
gemini-actor/โโโ src/โ โโโ main.py # Core actor logic + hardcoded session valuesโโโ .actor/โ โโโ actor.json # Apify actor manifestโ โโโ INPUT_SCHEMA.json # Input schema(queries only)โโโ output_schema.json # Dataset view columnsโโโ dataset_schema.json # Per-record field typesโโโ requirements.txt # Python dependenciesโโโ Dockerfile # Container buildโโโ Agent.md # Internal developer/agent guideโโโ claude.md # AI assistant context fileโโโ README.md # This file
Local Development
# Install dependenciespip install apify requests# Run locally (requires Apify CLI)apify run
Dependencies
apify>=2.0.0requests>=2.31.0
Limitations
- Session cookies expire in ~24 hours and require a manual code update + redeploy
- Subject to Gemini's internal rate limits
- Response format may break if Google updates the
StreamGenerateprotocol - Not suitable for high-volume production use without cookie rotation
License
MIT
