google-browser-scraper 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {google_browser_scraper-0.1.0/src/google_browser_scraper.egg-info → google_browser_scraper-0.1.2}/PKG-INFO +183 -119
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/README.md +182 -118
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/pyproject.toml +1 -1
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/__init__.py +1 -1
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/cli.py +18 -16
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/hybrid.py +65 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/links.py +87 -2
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/quality.py +7 -5
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/scraper.py +31 -7
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2/src/google_browser_scraper.egg-info}/PKG-INFO +183 -119
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/test_hybrid.py +59 -2
- google_browser_scraper-0.1.2/tests/test_links.py +273 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/test_scraper.py +36 -0
- google_browser_scraper-0.1.0/tests/test_links.py +0 -112
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/LICENSE +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/MANIFEST.in +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/setup.cfg +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/__main__.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/browser.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/classify.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/doctor.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/engines.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/mcp.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/output.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/parse.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/pool.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/proxy.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/relay.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/server.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper/warmup.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper.egg-info/SOURCES.txt +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper.egg-info/dependency_links.txt +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper.egg-info/entry_points.txt +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper.egg-info/requires.txt +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/src/google_browser_scraper.egg-info/top_level.txt +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/fakegoogle.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/pages.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/stdio_mcp_child.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/test_browser_local.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/test_classify.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/test_cli_and_output.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/test_engines_local.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/test_parse.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/test_pool.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/test_proxy.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/test_relay.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/test_serve_and_mcp.py +0 -0
- {google_browser_scraper-0.1.0 → google_browser_scraper-0.1.2}/tests/test_warmup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-browser-scraper
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Google Search results from a real browser through your own sticky proxy, with captchas and blocks reported explicitly.
|
|
5
5
|
Author: NodeMaven
|
|
6
6
|
License: MIT
|
|
@@ -47,7 +47,7 @@ Dynamic: license-file
|
|
|
47
47
|
|
|
48
48
|
<a href="https://devhunt.org/tool/google-search-scraper"><img src="https://devhunt.org/badge/google-search-scraper.svg" alt="Google Browser Scraper on DevHunt" height="44"></a>
|
|
49
49
|
|
|
50
|
-
[Quickstart](#quickstart) · [Output](#what-you-get) · [HTTP API](#run-it-as-an-api) · [MCP](#use-it-from-an-ai-agent-mcp) · [Docker](#docker) · [How it works](#how-it-works) · [Options](#options)
|
|
50
|
+
[Quickstart](#quickstart) · [Output](#what-you-get) · [Poisoned results](#poisoned-results-protection) · [HTTP API](#run-it-as-an-api) · [MCP](#use-it-from-an-ai-agent-mcp) · [Docker](#docker) · [How it works](#how-it-works) · [Options](#options)
|
|
51
51
|
|
|
52
52
|
</div>
|
|
53
53
|
|
|
@@ -57,41 +57,86 @@ Dynamic: license-file
|
|
|
57
57
|
<img src="https://raw.githubusercontent.com/nodemaven/google-browser-scraper/main/assets/demo.gif" alt="A real Chrome window showing Google results next to the JSON the scraper produced for them" width="900">
|
|
58
58
|
</p>
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
<div align="center">
|
|
61
|
+
|
|
62
|
+
| ✅ **100%** | 📉 **0.4 MB** | ⚡ **1.4 s** |
|
|
63
|
+
|:---:|:---:|:---:|
|
|
64
|
+
| success rate | per search | per search on a warm proxy IP |
|
|
65
|
+
|
|
66
|
+
<sub>Latest version benchmarks (v0.1)</sub>
|
|
61
67
|
|
|
62
|
-
|
|
63
|
-
- 0.4 MB per search once an exit is warm; warming a new exit costs 30-110 MB
|
|
64
|
-
- 1.4 seconds per search on a warm exit (median)
|
|
68
|
+
</div>
|
|
65
69
|
|
|
66
70
|
Scrape Google search results (SERP) with a real Chrome browser and your own
|
|
67
71
|
residential proxy, and get clean JSON back. Use it as a CLI, a Python library,
|
|
68
72
|
a local HTTP API, or an MCP server that gives AI agents live Google search.
|
|
69
73
|
|
|
70
|
-
Plain HTTP is no longer a reliable way to scrape Google
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
JSON record per results page. Captchas, blocks and failures are reported as
|
|
76
|
-
such, never as "no results".
|
|
77
|
-
|
|
78
|
-
Once Google serves the browser, most results pages come over direct HTTPS
|
|
79
|
-
requests with the browser's own cookies and request headers, and the browser
|
|
80
|
-
runs only when Google asks for its check again or a request does not bring a
|
|
81
|
-
usable page. A results page fetched that way is a single
|
|
82
|
-
document instead of a fully rendered page, so it costs a fraction of the
|
|
83
|
-
traffic.
|
|
74
|
+
Plain HTTP is no longer a reliable way to scrape Google, and a fresh browser on a
|
|
75
|
+
fresh proxy IP is refused quickly. So the scraper warms a sticky proxy session
|
|
76
|
+
with ordinary browsing, lets the browser pass Google's checks, and then fetches
|
|
77
|
+
results pages directly over HTTPS with the browser's own cookies. Captchas and
|
|
78
|
+
blocks are reported as such, never as "no results".
|
|
84
79
|
|
|
85
80
|
## Features
|
|
86
81
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
<table>
|
|
83
|
+
<tr>
|
|
84
|
+
<td width="50%" valign="top">
|
|
85
|
+
|
|
86
|
+
⚡ **Hybrid mode**<br>
|
|
87
|
+
Results pages over HTTPS between Google's checks: a fraction of a browser's traffic and time. The browser takes over by itself when needed.
|
|
88
|
+
|
|
89
|
+
</td>
|
|
90
|
+
<td width="50%" valign="top">
|
|
91
|
+
|
|
92
|
+
🛡️ **Poisoned results protection**<br>
|
|
93
|
+
Pages of results for some other query are caught: the proxy IP serving them is dropped within a few pages and the query is asked again on a fresh one.
|
|
94
|
+
|
|
95
|
+
</td>
|
|
96
|
+
</tr>
|
|
97
|
+
<tr>
|
|
98
|
+
<td valign="top">
|
|
99
|
+
|
|
100
|
+
🌐 **Real browser**<br>
|
|
101
|
+
Real Chrome via Patchright, warmed up before every new identity, so Google's checks pass.
|
|
102
|
+
|
|
103
|
+
</td>
|
|
104
|
+
<td valign="top">
|
|
105
|
+
|
|
106
|
+
🧩 **SERP API-style JSON**<br>
|
|
107
|
+
`organic_results`, `ads`, `related_questions`, `related_searches`, `pagination`, `ai_overview`, `local_results`.
|
|
108
|
+
|
|
109
|
+
</td>
|
|
110
|
+
</tr>
|
|
111
|
+
<tr>
|
|
112
|
+
<td valign="top">
|
|
113
|
+
|
|
114
|
+
🔌 **Bring your own proxy**<br>
|
|
115
|
+
Any residential proxy with sticky sessions, built-in [NodeMaven](https://nodemaven.com/?utm_source=github&utm_medium=readme&utm_campaign=google_browser_scraper&utm_content=features) support.
|
|
116
|
+
|
|
117
|
+
</td>
|
|
118
|
+
<td valign="top">
|
|
119
|
+
|
|
120
|
+
🚦 **Honest failures**<br>
|
|
121
|
+
Captchas and blocks come back labeled, not as empty results.
|
|
122
|
+
|
|
123
|
+
</td>
|
|
124
|
+
</tr>
|
|
125
|
+
<tr>
|
|
126
|
+
<td valign="top">
|
|
127
|
+
|
|
128
|
+
🤖 **For AI agents**<br>
|
|
129
|
+
An MCP server that gives agents live Google search, with the AI Overview and map places.
|
|
130
|
+
|
|
131
|
+
</td>
|
|
132
|
+
<td valign="top">
|
|
133
|
+
|
|
134
|
+
🐳 **Run it your way**<br>
|
|
135
|
+
CLI, Python library, HTTP API, MCP server or Docker image. Traffic and cost per 1000 pages in every run summary.
|
|
136
|
+
|
|
137
|
+
</td>
|
|
138
|
+
</tr>
|
|
139
|
+
</table>
|
|
95
140
|
|
|
96
141
|
## Use cases
|
|
97
142
|
|
|
@@ -109,8 +154,9 @@ patchright install chromium
|
|
|
109
154
|
|
|
110
155
|
## Quickstart
|
|
111
156
|
|
|
112
|
-
|
|
113
|
-
|
|
157
|
+
> [!NOTE]
|
|
158
|
+
> You need a residential proxy with **sticky sessions**. Put `{session}` where
|
|
159
|
+
> your provider expects a session id in the username.
|
|
114
160
|
|
|
115
161
|
```bash
|
|
116
162
|
google-browser-scraper search "best running shoes" \
|
|
@@ -118,13 +164,13 @@ google-browser-scraper search "best running shoes" \
|
|
|
118
164
|
-o results.jsonl
|
|
119
165
|
```
|
|
120
166
|
|
|
121
|
-
The first query takes a few minutes
|
|
122
|
-
the
|
|
123
|
-
|
|
124
|
-
|
|
167
|
+
The first query takes a few minutes while a new proxy IP warms up; later queries on
|
|
168
|
+
the same proxy IP take seconds. Every run ends with a summary of pages served and
|
|
169
|
+
traffic used.
|
|
170
|
+
|
|
171
|
+
### With NodeMaven
|
|
125
172
|
|
|
126
|
-
|
|
127
|
-
session id is handled for you and the credentials come from the environment:
|
|
173
|
+
The session id is handled for you and the credentials come from the environment:
|
|
128
174
|
|
|
129
175
|
```bash
|
|
130
176
|
pip install "google-browser-scraper[nodemaven]"
|
|
@@ -135,27 +181,39 @@ google-browser-scraper search -f queries.txt --nodemaven --country us -o results
|
|
|
135
181
|
> [!TIP]
|
|
136
182
|
> 🎁 **2 GB of free traffic.** No NodeMaven account yet? [Sign up](https://dashboard.nodemaven.com/accounts/signup/?utm_source=github&utm_medium=readme&utm_campaign=google_browser_scraper&utm_content=signup_promo) and enter the code **GOOGLENM**. Once per account.
|
|
137
183
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
184
|
+
<details>
|
|
185
|
+
<summary><b>Cap a run's traffic with a demo sub-user</b></summary>
|
|
186
|
+
|
|
187
|
+
<br>
|
|
188
|
+
|
|
189
|
+
`--nodemaven-demo` creates a sub-user with a traffic limit from your dashboard API
|
|
190
|
+
key, shares it across workers, and deletes it when the run ends (`--keep-subuser`
|
|
191
|
+
keeps it). The account needs sub-users enabled. A fresh warm-up alone uses about
|
|
192
|
+
60 MB, so keep the cap well above that:
|
|
142
193
|
|
|
143
194
|
```bash
|
|
144
195
|
export NODEMAVEN_API_KEY=...
|
|
145
196
|
google-browser-scraper search -f queries.txt --nodemaven-demo --traffic-limit-mb 300 -o results.jsonl
|
|
146
197
|
```
|
|
147
198
|
|
|
148
|
-
|
|
199
|
+
</details>
|
|
200
|
+
|
|
201
|
+
<details>
|
|
202
|
+
<summary><b>Try it without a proxy</b></summary>
|
|
203
|
+
|
|
204
|
+
<br>
|
|
149
205
|
|
|
150
206
|
```bash
|
|
151
207
|
google-browser-scraper search "best running shoes" --no-proxy
|
|
152
208
|
```
|
|
153
209
|
|
|
154
210
|
Google then sees one address for every query, so it starts answering with
|
|
155
|
-
captchas sooner than it would across a pool of
|
|
211
|
+
captchas sooner than it would across a pool of proxy IPs. Those pages come back as
|
|
156
212
|
`captcha` in `page_verdict`, not as empty results.
|
|
157
213
|
|
|
158
|
-
|
|
214
|
+
</details>
|
|
215
|
+
|
|
216
|
+
### From Python
|
|
159
217
|
|
|
160
218
|
```python
|
|
161
219
|
from google_browser_scraper import ProxyTemplate, Scraper, Settings
|
|
@@ -172,34 +230,51 @@ One JSON object per results page:
|
|
|
172
230
|
|
|
173
231
|
```json
|
|
174
232
|
{
|
|
175
|
-
"search_metadata": {"status": "Success", "page_verdict": "ok"},
|
|
233
|
+
"search_metadata": {"status": "Success", "page_verdict": "ok", "fetched_with": "http"},
|
|
176
234
|
"search_parameters": {"engine": "google", "q": "best running shoes", "page": 1},
|
|
177
235
|
"organic_results": [
|
|
178
236
|
{"position": 1, "title": "...", "link": "https://...", "snippet": "..."}
|
|
179
237
|
],
|
|
180
238
|
"related_questions": [{"question": "..."}],
|
|
239
|
+
"ai_overview": {"text": "..."},
|
|
181
240
|
"exit": {"session": "...", "queries_on_exit": 1, "bytes": "..."}
|
|
182
241
|
}
|
|
183
242
|
```
|
|
184
243
|
|
|
185
|
-
The
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
244
|
+
The field names are the ones common to SERP APIs, so simple consumers can often
|
|
245
|
+
switch with minimal mapping.
|
|
246
|
+
|
|
247
|
+
<details>
|
|
248
|
+
<summary><b>All fields</b></summary>
|
|
249
|
+
|
|
250
|
+
<br>
|
|
251
|
+
|
|
252
|
+
- `organic_results`, `ads`, `related_questions`, `related_searches`, `pagination`, `search_metadata`
|
|
253
|
+
- `ai_overview`: the text of Google's AI Overview when the page shows one (pages in English, `--hl en`, the default)
|
|
254
|
+
- `local_results`: the places of the map pack on local queries (name, rating, reviews, type, address, phone, opening hours)
|
|
255
|
+
- `exit`: which proxy IP (sticky session) answered and how many bytes the page cost
|
|
256
|
+
- `search_metadata.fetched_with`: `http` or `browser`
|
|
257
|
+
- `search_metadata.timings`: seconds per step (`http` for a page fetched over HTTP; `type`, `load`, `ready` and `read` for one the browser rendered; `parse`; `links`, which overlaps the next query)
|
|
258
|
+
- A query that failed is a record too, with an `error`
|
|
259
|
+
|
|
192
260
|
Knowledge panels, shopping, images and other special blocks are not parsed.
|
|
261
|
+
`--format csv` writes the organic results as a table, and `--price-per-gb` adds
|
|
262
|
+
the cost per 1000 pages to the summary.
|
|
263
|
+
|
|
264
|
+
</details>
|
|
193
265
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
266
|
+
## Poisoned results protection
|
|
267
|
+
|
|
268
|
+
Google does not always block a scraper. Sometimes it answers with a normal-looking
|
|
269
|
+
results page for a different query: no captcha, no error, just wrong data that
|
|
270
|
+
slips into your pipeline unnoticed.
|
|
271
|
+
|
|
272
|
+
The scraper checks results pages against the queries it asked. When a proxy IP
|
|
273
|
+
starts returning unrelated results, it is dropped within a few pages and the query
|
|
274
|
+
is asked again on a fresh one.
|
|
275
|
+
|
|
276
|
+
- No extra requests, no extra traffic: the check runs on the page already downloaded
|
|
277
|
+
- On by default
|
|
203
278
|
|
|
204
279
|
## Run it as an API
|
|
205
280
|
|
|
@@ -208,14 +283,11 @@ google-browser-scraper serve --nodemaven --country us --prewarm
|
|
|
208
283
|
curl "http://127.0.0.1:8000/search.json?q=best+running+shoes"
|
|
209
284
|
```
|
|
210
285
|
|
|
211
|
-
Same record format as above
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
503 `warming` until then; a request sent earlier waits in line behind it. Set
|
|
217
|
-
`GBS_API_KEY` to require a key; without one the server only listens on
|
|
218
|
-
localhost.
|
|
286
|
+
- Same record format as above
|
|
287
|
+
- `hl` (language) and `gl` (country) per request: `/search.json?q=...&hl=de&gl=at`
|
|
288
|
+
- `--prewarm` finds a proxy IP Google serves at startup, so the first request does not wait for a warm-up; `/health` answers 503 `warming` until then
|
|
289
|
+
- Requests run one at a time on one held proxy IP
|
|
290
|
+
- Set `GBS_API_KEY` to require a key; without one the server only listens on localhost
|
|
219
291
|
|
|
220
292
|
## Use it from an AI agent (MCP)
|
|
221
293
|
|
|
@@ -231,9 +303,9 @@ localhost.
|
|
|
231
303
|
}
|
|
232
304
|
```
|
|
233
305
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
306
|
+
One tool, `google_search(query, pages, hl, gl)`. It returns the organic results,
|
|
307
|
+
"People also ask", related searches, and the AI Overview and map places when
|
|
308
|
+
Google shows them.
|
|
237
309
|
|
|
238
310
|
## Docker
|
|
239
311
|
|
|
@@ -252,62 +324,54 @@ To build it yourself: `docker build -t google-browser-scraper .`
|
|
|
252
324
|
|
|
253
325
|
1. **New identity:** a sticky proxy session and a fresh browser profile.
|
|
254
326
|
2. **Warm-up:** a few ordinary pages, staying on each for 20-45 seconds.
|
|
255
|
-
3. **Search:**
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
exit it refuses is dropped and the query is retried on a new one. If exit
|
|
264
|
-
after exit is refused, the run stops instead of spending more traffic.
|
|
327
|
+
3. **Search:** the first query on a proxy IP goes through the browser. Once Google
|
|
328
|
+
serves it, the next pages come over HTTPS with the browser's cookies, until
|
|
329
|
+
Google asks for its check again.
|
|
330
|
+
4. **Check before parsing:** a captcha or a block is reported as one, never
|
|
331
|
+
parsed as an empty result.
|
|
332
|
+
5. **Keep or drop:** a proxy IP Google answers is reused; one it refuses is dropped
|
|
333
|
+
and the query retried on a new one. If one proxy IP after another is refused, the run
|
|
334
|
+
stops instead of spending more traffic.
|
|
265
335
|
|
|
266
336
|
<details>
|
|
267
|
-
<summary><b>More detail: HTTP between checks, holding
|
|
337
|
+
<summary><b>More detail: HTTP between checks, holding proxy IPs, copied cookies, result links, traffic</b></summary>
|
|
268
338
|
|
|
269
339
|
<br>
|
|
270
340
|
|
|
271
|
-
**HTTP between checks.**
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
**Unrelated results.** Google is reported to answer some automated traffic with
|
|
281
|
-
a normal-looking page of results for other queries instead of a block. When three
|
|
282
|
-
pages in a row on one exit have almost no title that carries the query's words,
|
|
283
|
-
the exit is dropped and the query asked again on a new one. One-word queries are
|
|
284
|
-
not judged.
|
|
285
|
-
|
|
286
|
-
**Holding exits.** A served exit is kept for up to 300 queries. Every new exit
|
|
341
|
+
**HTTP between checks.** After the browser passes Google's check, results pages
|
|
342
|
+
are fetched over HTTPS with the browser's own headers and cookies. If that stops
|
|
343
|
+
working, the scraper goes back to the browser on its own. `--no-hybrid` uses the
|
|
344
|
+
browser for every page.
|
|
345
|
+
|
|
346
|
+
**Unrelated results.** A proxy IP that starts returning results unrelated to the
|
|
347
|
+
queries is dropped, and the query is asked again on a new one.
|
|
348
|
+
|
|
349
|
+
**Holding proxy IPs.** A served proxy IP is kept for up to 300 queries. Every new one
|
|
287
350
|
pays for a warm-up, so a short cap mostly buys more warm-up traffic. Every 50
|
|
288
|
-
results pages it renders, the browser is restarted on the same profile and
|
|
351
|
+
results pages it renders, the browser is restarted on the same profile and proxy IP, which keeps
|
|
289
352
|
its memory from growing over a long hold. A browser error on a search is retried
|
|
290
|
-
once on the same
|
|
353
|
+
once on the same proxy IP before it is dropped; a network error, running out of
|
|
291
354
|
memory or a crashed browser drops it at once.
|
|
292
355
|
|
|
293
|
-
**Copying cookies.** The command line copies the cookies of the first
|
|
294
|
-
Google serves and starts new
|
|
356
|
+
**Copying cookies.** The command line copies the cookies of the first proxy IP
|
|
357
|
+
Google serves and starts new proxy IPs from that copy, on new sticky sessions,
|
|
295
358
|
instead of warming each one; all workers share the copy. Google's acceptance
|
|
296
359
|
follows the cookies more than the address, so a copy usually starts out served
|
|
297
360
|
and costs a few MB instead of a full warm-up. A copy waits 40-60 seconds after
|
|
298
361
|
its browser starts before the first search.
|
|
299
362
|
|
|
300
|
-
**Copying the cache.** Pages get cheaper as
|
|
363
|
+
**Copying the cache.** Pages get cheaper as a proxy IP is held, because the
|
|
301
364
|
browser cache fills with Google's shared scripts and images. Copies carry that
|
|
302
|
-
cache too, so a new
|
|
303
|
-
from the held
|
|
365
|
+
cache too, so a new proxy IP starts with cheap pages, and the copy is refreshed
|
|
366
|
+
from the held one at each browser restart, when its cache is warm. If two
|
|
304
367
|
copies carrying the cache are refused on their first search, the rest of the
|
|
305
368
|
run copies cookies only (`--no-clone-cache` does that from the start).
|
|
306
369
|
|
|
307
370
|
**Result links.** Google wraps result links in encrypted `/goto` redirects.
|
|
308
|
-
Each one is resolved with a small request
|
|
309
|
-
|
|
310
|
-
|
|
371
|
+
Each one is resolved with a small request on the proxy IP the page came from,
|
|
372
|
+
with that page's cookies, in the background while the next query runs; a link
|
|
373
|
+
left over is tried through a separate short-lived proxy session. Records still
|
|
374
|
+
come out in the order each browser searched them.
|
|
311
375
|
|
|
312
376
|
**Traffic.** Everything goes through a small local relay that counts bytes per
|
|
313
377
|
host and blocks a large model download Chrome otherwise makes on every fresh
|
|
@@ -327,20 +391,20 @@ The defaults come from measurements in
|
|
|
327
391
|
|
|
328
392
|
| Option | Default | What it does |
|
|
329
393
|
|---|---|---|
|
|
330
|
-
| `--workers N` | 1 | Search on N
|
|
331
|
-
| `--max-per-exit N` | 300 | Queries before a served
|
|
332
|
-
| `--restart-every N` | 50 | Results pages the browser rendered before it restarts on the same profile and
|
|
394
|
+
| `--workers N` | 1 | Search on N proxy IPs at once, one browser each, from one list of queries |
|
|
395
|
+
| `--max-per-exit N` | 300 | Queries before a served proxy IP is retired |
|
|
396
|
+
| `--restart-every N` | 50 | Results pages the browser rendered before it restarts on the same profile and proxy IP; `0` never |
|
|
333
397
|
| `--no-hybrid` | | Fetch every results page in the browser instead of over HTTP between Google's checks |
|
|
334
398
|
| `--hl`, `--gl` | `en`, unset | Language and country of the results |
|
|
335
|
-
| `--clone N` | 10 | New
|
|
399
|
+
| `--clone N` | 10 | New proxy IPs started from copied cookies; `0` turns copying off |
|
|
336
400
|
| `--clone-max-age` | 180 | Minutes copied cookies stay in use |
|
|
337
401
|
| `--clone-refusals N` | 1 | Copies refused in a row on their first query that end the copying |
|
|
338
402
|
| `--no-clone-cache` | | Copies carry cookies only, not the browser cache |
|
|
339
|
-
| `--warmup` | `L3` | Pages a fresh
|
|
340
|
-
| `--spare N` | 0 |
|
|
341
|
-
| `--direct` | `all` | Open results pages directly: `all`, `follow-ups` (all but
|
|
403
|
+
| `--warmup` | `L3` | Pages a fresh proxy IP opens before its first query: `L3`, `light` (without Google Trends: much less traffic, served on the first query less often), `L2`, `L1`, `off` |
|
|
404
|
+
| `--spare N` | 0 | Proxy IPs warmed in the background so a retired one is replaced at once; each costs a warm-up |
|
|
405
|
+
| `--direct` | `all` | Open results pages directly: `all`, `follow-ups` (all but the first query on each proxy IP), `none` |
|
|
342
406
|
| `--input` | `type` | How a query goes into the search box: `type`, `insert`, `words` |
|
|
343
|
-
| `--gap LOW,HIGH` | 2,5 | Seconds between queries on one
|
|
407
|
+
| `--gap LOW,HIGH` | 2,5 | Seconds between queries on one proxy IP |
|
|
344
408
|
| `--pages N` | 1 | Result pages per query |
|
|
345
409
|
| `--format` | `jsonl` | `jsonl` or `csv` |
|
|
346
410
|
| `--price-per-gb` | | Your proxy price, to print the cost per 1000 pages |
|
|
@@ -354,7 +418,7 @@ The defaults come from measurements in
|
|
|
354
418
|
## Proxies
|
|
355
419
|
|
|
356
420
|
Any provider with sticky sessions works through `--proxy` and a `{session}`
|
|
357
|
-
placeholder. A proxy without one is accepted with a warning: if the
|
|
421
|
+
placeholder. A proxy without one is accepted with a warning: if the proxy IP changes
|
|
358
422
|
on every request, warming it does nothing. SOCKS5 needs an IP-whitelisted
|
|
359
423
|
endpoint, because Chrome cannot send a SOCKS5 username and password.
|
|
360
424
|
|
|
@@ -370,8 +434,8 @@ size. Google answers some machines much less than others, so run this first.
|
|
|
370
434
|
|
|
371
435
|
## What this is not
|
|
372
436
|
|
|
373
|
-
Not a free Google Search API, and not a guarantee that every proxy
|
|
374
|
-
work. It is a browser-based collector that makes failures explicit, drops
|
|
437
|
+
Not a free Google Search API, and not a guarantee that every proxy IP will
|
|
438
|
+
work. It is a browser-based collector that makes failures explicit, drops proxy IPs
|
|
375
439
|
Google refuses, and tells you what each page cost.
|
|
376
440
|
|
|
377
441
|
## Status
|