google-browser-scraper 0.1.1__tar.gz → 0.2.0__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.2.0/PKG-INFO +38 -0
- google_browser_scraper-0.2.0/README.md +14 -0
- google_browser_scraper-0.2.0/pyproject.toml +38 -0
- google_browser_scraper-0.2.0/src/google_browser_scraper/__init__.py +45 -0
- {google_browser_scraper-0.1.1 → google_browser_scraper-0.2.0}/src/google_browser_scraper/__main__.py +1 -1
- google_browser_scraper-0.2.0/src/google_browser_scraper.egg-info/PKG-INFO +38 -0
- google_browser_scraper-0.2.0/src/google_browser_scraper.egg-info/SOURCES.txt +11 -0
- google_browser_scraper-0.2.0/src/google_browser_scraper.egg-info/entry_points.txt +2 -0
- google_browser_scraper-0.2.0/src/google_browser_scraper.egg-info/requires.txt +13 -0
- google_browser_scraper-0.1.1/MANIFEST.in +0 -1
- google_browser_scraper-0.1.1/PKG-INFO +0 -467
- google_browser_scraper-0.1.1/README.md +0 -435
- google_browser_scraper-0.1.1/pyproject.toml +0 -61
- google_browser_scraper-0.1.1/src/google_browser_scraper/__init__.py +0 -27
- google_browser_scraper-0.1.1/src/google_browser_scraper/browser.py +0 -398
- google_browser_scraper-0.1.1/src/google_browser_scraper/classify.py +0 -105
- google_browser_scraper-0.1.1/src/google_browser_scraper/cli.py +0 -464
- google_browser_scraper-0.1.1/src/google_browser_scraper/doctor.py +0 -155
- google_browser_scraper-0.1.1/src/google_browser_scraper/engines.py +0 -55
- google_browser_scraper-0.1.1/src/google_browser_scraper/hybrid.py +0 -489
- google_browser_scraper-0.1.1/src/google_browser_scraper/links.py +0 -147
- google_browser_scraper-0.1.1/src/google_browser_scraper/mcp.py +0 -195
- google_browser_scraper-0.1.1/src/google_browser_scraper/output.py +0 -151
- google_browser_scraper-0.1.1/src/google_browser_scraper/parse.py +0 -538
- google_browser_scraper-0.1.1/src/google_browser_scraper/pool.py +0 -194
- google_browser_scraper-0.1.1/src/google_browser_scraper/proxy.py +0 -196
- google_browser_scraper-0.1.1/src/google_browser_scraper/quality.py +0 -63
- google_browser_scraper-0.1.1/src/google_browser_scraper/relay.py +0 -306
- google_browser_scraper-0.1.1/src/google_browser_scraper/scraper.py +0 -1445
- google_browser_scraper-0.1.1/src/google_browser_scraper/server.py +0 -311
- google_browser_scraper-0.1.1/src/google_browser_scraper/warmup.py +0 -44
- google_browser_scraper-0.1.1/src/google_browser_scraper.egg-info/PKG-INFO +0 -467
- google_browser_scraper-0.1.1/src/google_browser_scraper.egg-info/SOURCES.txt +0 -45
- google_browser_scraper-0.1.1/src/google_browser_scraper.egg-info/entry_points.txt +0 -2
- google_browser_scraper-0.1.1/src/google_browser_scraper.egg-info/requires.txt +0 -17
- google_browser_scraper-0.1.1/tests/fakegoogle.py +0 -91
- google_browser_scraper-0.1.1/tests/pages.py +0 -149
- google_browser_scraper-0.1.1/tests/stdio_mcp_child.py +0 -39
- google_browser_scraper-0.1.1/tests/test_browser_local.py +0 -149
- google_browser_scraper-0.1.1/tests/test_classify.py +0 -58
- google_browser_scraper-0.1.1/tests/test_cli_and_output.py +0 -197
- google_browser_scraper-0.1.1/tests/test_engines_local.py +0 -161
- google_browser_scraper-0.1.1/tests/test_hybrid.py +0 -410
- google_browser_scraper-0.1.1/tests/test_links.py +0 -112
- google_browser_scraper-0.1.1/tests/test_parse.py +0 -235
- google_browser_scraper-0.1.1/tests/test_pool.py +0 -255
- google_browser_scraper-0.1.1/tests/test_proxy.py +0 -178
- google_browser_scraper-0.1.1/tests/test_relay.py +0 -247
- google_browser_scraper-0.1.1/tests/test_scraper.py +0 -1251
- google_browser_scraper-0.1.1/tests/test_serve_and_mcp.py +0 -498
- google_browser_scraper-0.1.1/tests/test_warmup.py +0 -15
- {google_browser_scraper-0.1.1 → google_browser_scraper-0.2.0}/LICENSE +0 -0
- {google_browser_scraper-0.1.1 → google_browser_scraper-0.2.0}/setup.cfg +0 -0
- {google_browser_scraper-0.1.1 → google_browser_scraper-0.2.0}/src/google_browser_scraper.egg-info/dependency_links.txt +0 -0
- {google_browser_scraper-0.1.1 → google_browser_scraper-0.2.0}/src/google_browser_scraper.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: google-browser-scraper
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Renamed to gserp. Installing this installs gserp and keeps the old command and import working.
|
|
5
|
+
Author: NodeMaven
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Source, https://github.com/nodemaven/gserp
|
|
8
|
+
Project-URL: New package, https://pypi.org/project/gserp/
|
|
9
|
+
Classifier: Development Status :: 7 - Inactive
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: gserp>=0.2.0
|
|
15
|
+
Provides-Extra: nodemaven
|
|
16
|
+
Requires-Dist: gserp[nodemaven]>=0.2.0; extra == "nodemaven"
|
|
17
|
+
Provides-Extra: cloak
|
|
18
|
+
Requires-Dist: gserp[cloak]>=0.2.0; extra == "cloak"
|
|
19
|
+
Provides-Extra: all
|
|
20
|
+
Requires-Dist: gserp[all]>=0.2.0; extra == "all"
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: gserp[dev]>=0.2.0; extra == "dev"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# google-browser-scraper is now gserp
|
|
26
|
+
|
|
27
|
+
This project was renamed to [gserp](https://pypi.org/project/gserp/).
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
pip install gserp
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Installing `google-browser-scraper` installs `gserp` and keeps the old names working: the `google-browser-scraper` command,
|
|
34
|
+
`import google_browser_scraper` (with a deprecation warning) and the `GBS_*`
|
|
35
|
+
environment variables. New code should use `gserp`, `import gserp` and
|
|
36
|
+
`GSERP_*`.
|
|
37
|
+
|
|
38
|
+
Source and documentation: https://github.com/nodemaven/gserp
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# google-browser-scraper is now gserp
|
|
2
|
+
|
|
3
|
+
This project was renamed to [gserp](https://pypi.org/project/gserp/).
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
pip install gserp
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Installing `google-browser-scraper` installs `gserp` and keeps the old names working: the `google-browser-scraper` command,
|
|
10
|
+
`import google_browser_scraper` (with a deprecation warning) and the `GBS_*`
|
|
11
|
+
environment variables. New code should use `gserp`, `import gserp` and
|
|
12
|
+
`GSERP_*`.
|
|
13
|
+
|
|
14
|
+
Source and documentation: https://github.com/nodemaven/gserp
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# The old distribution name, kept so that `pip install google-browser-scraper`,
|
|
2
|
+
# the `google-browser-scraper` command and `import google_browser_scraper` go on
|
|
3
|
+
# working. It holds no code of its own: it installs `gserp`, this version or newer.
|
|
4
|
+
[build-system]
|
|
5
|
+
# 77 for `license-files` in [project].
|
|
6
|
+
requires = ["setuptools>=77"]
|
|
7
|
+
build-backend = "setuptools.build_meta"
|
|
8
|
+
|
|
9
|
+
[project]
|
|
10
|
+
name = "google-browser-scraper"
|
|
11
|
+
version = "0.2.0"
|
|
12
|
+
description = "Renamed to gserp. Installing this installs gserp and keeps the old command and import working."
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
license = "MIT"
|
|
15
|
+
license-files = ["LICENSE"]
|
|
16
|
+
requires-python = ">=3.10"
|
|
17
|
+
authors = [{ name = "NodeMaven" }]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 7 - Inactive",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
]
|
|
22
|
+
dependencies = ["gserp>=0.2.0"]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
nodemaven = ["gserp[nodemaven]>=0.2.0"]
|
|
26
|
+
cloak = ["gserp[cloak]>=0.2.0"]
|
|
27
|
+
all = ["gserp[all]>=0.2.0"]
|
|
28
|
+
dev = ["gserp[dev]>=0.2.0"]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
google-browser-scraper = "google_browser_scraper:main"
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Source = "https://github.com/nodemaven/gserp"
|
|
35
|
+
"New package" = "https://pypi.org/project/gserp/"
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.packages.find]
|
|
38
|
+
where = ["src"]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""The old name of `gserp`.
|
|
2
|
+
|
|
3
|
+
`google-browser-scraper` was renamed to `gserp`. This package installs `gserp`
|
|
4
|
+
and keeps the old import, command and `python -m` working: every
|
|
5
|
+
`google_browser_scraper.<module>` is the same module object as `gserp.<module>`.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import importlib
|
|
9
|
+
import pkgutil
|
|
10
|
+
import sys
|
|
11
|
+
import warnings
|
|
12
|
+
|
|
13
|
+
import gserp
|
|
14
|
+
from gserp import * # noqa: F403
|
|
15
|
+
from gserp import __all__, __version__ # noqa: F401
|
|
16
|
+
|
|
17
|
+
# FutureWarning, not DeprecationWarning: Python shows it by default wherever the
|
|
18
|
+
# import happens, and this one is meant for the people running the code.
|
|
19
|
+
warnings.warn(
|
|
20
|
+
"google_browser_scraper is now gserp: pip install gserp and import gserp",
|
|
21
|
+
FutureWarning,
|
|
22
|
+
stacklevel=2,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
# Every public gserp module, read from the installed package so a module added
|
|
26
|
+
# later is aliased too. `__main__` and private modules are left out: importing
|
|
27
|
+
# `gserp.__main__` would run the CLI.
|
|
28
|
+
MODULES = tuple(
|
|
29
|
+
info.name for info in pkgutil.iter_modules(gserp.__path__) if not info.name.startswith("_")
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
for _name in MODULES:
|
|
33
|
+
_module = importlib.import_module(f"gserp.{_name}")
|
|
34
|
+
sys.modules[f"{__name__}.{_name}"] = _module
|
|
35
|
+
setattr(sys.modules[__name__], _name, _module)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def main() -> int:
|
|
39
|
+
"""The old command, `google-browser-scraper`: the `gserp` CLI."""
|
|
40
|
+
from gserp.cli import main as gserp_main
|
|
41
|
+
|
|
42
|
+
return gserp_main()
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
del _name, _module, gserp
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: google-browser-scraper
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Renamed to gserp. Installing this installs gserp and keeps the old command and import working.
|
|
5
|
+
Author: NodeMaven
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Source, https://github.com/nodemaven/gserp
|
|
8
|
+
Project-URL: New package, https://pypi.org/project/gserp/
|
|
9
|
+
Classifier: Development Status :: 7 - Inactive
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: gserp>=0.2.0
|
|
15
|
+
Provides-Extra: nodemaven
|
|
16
|
+
Requires-Dist: gserp[nodemaven]>=0.2.0; extra == "nodemaven"
|
|
17
|
+
Provides-Extra: cloak
|
|
18
|
+
Requires-Dist: gserp[cloak]>=0.2.0; extra == "cloak"
|
|
19
|
+
Provides-Extra: all
|
|
20
|
+
Requires-Dist: gserp[all]>=0.2.0; extra == "all"
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: gserp[dev]>=0.2.0; extra == "dev"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# google-browser-scraper is now gserp
|
|
26
|
+
|
|
27
|
+
This project was renamed to [gserp](https://pypi.org/project/gserp/).
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
pip install gserp
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Installing `google-browser-scraper` installs `gserp` and keeps the old names working: the `google-browser-scraper` command,
|
|
34
|
+
`import google_browser_scraper` (with a deprecation warning) and the `GBS_*`
|
|
35
|
+
environment variables. New code should use `gserp`, `import gserp` and
|
|
36
|
+
`GSERP_*`.
|
|
37
|
+
|
|
38
|
+
Source and documentation: https://github.com/nodemaven/gserp
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/google_browser_scraper/__init__.py
|
|
5
|
+
src/google_browser_scraper/__main__.py
|
|
6
|
+
src/google_browser_scraper.egg-info/PKG-INFO
|
|
7
|
+
src/google_browser_scraper.egg-info/SOURCES.txt
|
|
8
|
+
src/google_browser_scraper.egg-info/dependency_links.txt
|
|
9
|
+
src/google_browser_scraper.egg-info/entry_points.txt
|
|
10
|
+
src/google_browser_scraper.egg-info/requires.txt
|
|
11
|
+
src/google_browser_scraper.egg-info/top_level.txt
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
recursive-include tests *.py
|
|
@@ -1,467 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: google-browser-scraper
|
|
3
|
-
Version: 0.1.1
|
|
4
|
-
Summary: Google Search results from a real browser through your own sticky proxy, with captchas and blocks reported explicitly.
|
|
5
|
-
Author: NodeMaven
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Source, https://github.com/nodemaven/google-browser-scraper
|
|
8
|
-
Project-URL: Issues, https://github.com/nodemaven/google-browser-scraper/issues
|
|
9
|
-
Project-URL: Benchmark, https://github.com/nodemaven/proxy-benchmark
|
|
10
|
-
Keywords: google,serp,scraper,search,proxy,playwright,patchright
|
|
11
|
-
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
|
|
15
|
-
Requires-Python: >=3.10
|
|
16
|
-
Description-Content-Type: text/markdown
|
|
17
|
-
License-File: LICENSE
|
|
18
|
-
Requires-Dist: patchright==1.64.3
|
|
19
|
-
Requires-Dist: lxml>=5
|
|
20
|
-
Requires-Dist: curl_cffi==0.17.0
|
|
21
|
-
Provides-Extra: nodemaven
|
|
22
|
-
Requires-Dist: nodemaven>=0.1.5; extra == "nodemaven"
|
|
23
|
-
Provides-Extra: cloak
|
|
24
|
-
Requires-Dist: cloakbrowser>=0.5; extra == "cloak"
|
|
25
|
-
Provides-Extra: all
|
|
26
|
-
Requires-Dist: nodemaven>=0.1.5; extra == "all"
|
|
27
|
-
Requires-Dist: cloakbrowser>=0.5; extra == "all"
|
|
28
|
-
Provides-Extra: dev
|
|
29
|
-
Requires-Dist: pytest>=8; extra == "dev"
|
|
30
|
-
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
31
|
-
Dynamic: license-file
|
|
32
|
-
|
|
33
|
-
<div align="center">
|
|
34
|
-
|
|
35
|
-
<img src="https://raw.githubusercontent.com/nodemaven/google-browser-scraper/main/assets/banner.png" alt="Google Browser Scraper">
|
|
36
|
-
|
|
37
|
-
<h1>google-browser-scraper</h1>
|
|
38
|
-
|
|
39
|
-
<p><b>Self-hosted SERP API alternative: Google search results from a real Chrome browser and your own residential proxy.</b></p>
|
|
40
|
-
|
|
41
|
-
[](https://pypi.org/project/google-browser-scraper/)
|
|
42
|
-
[](https://pypi.org/project/google-browser-scraper/)
|
|
43
|
-
[](https://github.com/nodemaven/google-browser-scraper/actions/workflows/ci.yml)
|
|
44
|
-
[](https://opensource.org/licenses/MIT)
|
|
45
|
-
[](https://github.com/nodemaven/google-browser-scraper/pkgs/container/google-browser-scraper)
|
|
46
|
-
[](https://dashboard.nodemaven.com/accounts/signup/?utm_source=github&utm_medium=readme&utm_campaign=google_browser_scraper&utm_content=promo_badge)
|
|
47
|
-
|
|
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
|
-
|
|
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
|
-
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
<br>
|
|
55
|
-
|
|
56
|
-
<p align="center">
|
|
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
|
-
</p>
|
|
59
|
-
|
|
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>
|
|
67
|
-
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
Scrape Google search results (SERP) with a real Chrome browser and your own
|
|
71
|
-
residential proxy, and get clean JSON back. Use it as a CLI, a Python library,
|
|
72
|
-
a local HTTP API, or an MCP server that gives AI agents live Google search.
|
|
73
|
-
|
|
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".
|
|
79
|
-
|
|
80
|
-
## Features
|
|
81
|
-
|
|
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>
|
|
140
|
-
|
|
141
|
-
## Use cases
|
|
142
|
-
|
|
143
|
-
- SEO rank tracking and SERP monitoring for your own keywords
|
|
144
|
-
- Keyword and competitor research from live Google results
|
|
145
|
-
- Web search for AI agents and LLM apps through MCP
|
|
146
|
-
- A self-hosted alternative to paid Google search APIs when you already pay for proxies
|
|
147
|
-
|
|
148
|
-
## Install
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
pip install google-browser-scraper
|
|
152
|
-
patchright install chromium
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## Quickstart
|
|
156
|
-
|
|
157
|
-
> [!NOTE]
|
|
158
|
-
> You need a residential proxy with **sticky sessions**. Put `{session}` where
|
|
159
|
-
> your provider expects a session id in the username.
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
google-browser-scraper search "best running shoes" \
|
|
163
|
-
--proxy "http://USER-session-{session}:PASS@gate.example.com:7000" \
|
|
164
|
-
-o results.jsonl
|
|
165
|
-
```
|
|
166
|
-
|
|
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
|
|
172
|
-
|
|
173
|
-
The session id is handled for you and the credentials come from the environment:
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
pip install "google-browser-scraper[nodemaven]"
|
|
177
|
-
export NODEMAVEN_LOGIN=... NODEMAVEN_PASSWORD=...
|
|
178
|
-
google-browser-scraper search -f queries.txt --nodemaven --country us -o results.jsonl
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
> [!TIP]
|
|
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.
|
|
183
|
-
|
|
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:
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
export NODEMAVEN_API_KEY=...
|
|
196
|
-
google-browser-scraper search -f queries.txt --nodemaven-demo --traffic-limit-mb 300 -o results.jsonl
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
</details>
|
|
200
|
-
|
|
201
|
-
<details>
|
|
202
|
-
<summary><b>Try it without a proxy</b></summary>
|
|
203
|
-
|
|
204
|
-
<br>
|
|
205
|
-
|
|
206
|
-
```bash
|
|
207
|
-
google-browser-scraper search "best running shoes" --no-proxy
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
Google then sees one address for every query, so it starts answering with
|
|
211
|
-
captchas sooner than it would across a pool of proxy IPs. Those pages come back as
|
|
212
|
-
`captcha` in `page_verdict`, not as empty results.
|
|
213
|
-
|
|
214
|
-
</details>
|
|
215
|
-
|
|
216
|
-
### From Python
|
|
217
|
-
|
|
218
|
-
```python
|
|
219
|
-
from google_browser_scraper import ProxyTemplate, Scraper, Settings
|
|
220
|
-
|
|
221
|
-
proxy = ProxyTemplate("http://USER-session-{session}:PASS@gate.example.com:7000")
|
|
222
|
-
for page in Scraper(proxy, Settings(pages=2)).run(["best running shoes"]):
|
|
223
|
-
for result in page.get("organic_results", []):
|
|
224
|
-
print(result["position"], result["title"], result["link"])
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
## What you get
|
|
228
|
-
|
|
229
|
-
One JSON object per results page:
|
|
230
|
-
|
|
231
|
-
```json
|
|
232
|
-
{
|
|
233
|
-
"search_metadata": {"status": "Success", "page_verdict": "ok", "fetched_with": "http"},
|
|
234
|
-
"search_parameters": {"engine": "google", "q": "best running shoes", "page": 1},
|
|
235
|
-
"organic_results": [
|
|
236
|
-
{"position": 1, "title": "...", "link": "https://...", "snippet": "..."}
|
|
237
|
-
],
|
|
238
|
-
"related_questions": [{"question": "..."}],
|
|
239
|
-
"ai_overview": {"text": "..."},
|
|
240
|
-
"exit": {"session": "...", "queries_on_exit": 1, "bytes": "..."}
|
|
241
|
-
}
|
|
242
|
-
```
|
|
243
|
-
|
|
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
|
-
|
|
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>
|
|
265
|
-
|
|
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
|
|
278
|
-
|
|
279
|
-
## Run it as an API
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
google-browser-scraper serve --nodemaven --country us --prewarm
|
|
283
|
-
curl "http://127.0.0.1:8000/search.json?q=best+running+shoes"
|
|
284
|
-
```
|
|
285
|
-
|
|
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
|
|
291
|
-
|
|
292
|
-
## Use it from an AI agent (MCP)
|
|
293
|
-
|
|
294
|
-
```json
|
|
295
|
-
{
|
|
296
|
-
"mcpServers": {
|
|
297
|
-
"google-search": {
|
|
298
|
-
"command": "google-browser-scraper",
|
|
299
|
-
"args": ["mcp", "--nodemaven", "--country", "us", "--prewarm"],
|
|
300
|
-
"env": {"NODEMAVEN_LOGIN": "...", "NODEMAVEN_PASSWORD": "..."}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
```
|
|
305
|
-
|
|
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.
|
|
309
|
-
|
|
310
|
-
## Docker
|
|
311
|
-
|
|
312
|
-
A ready image is published to GitHub Container Registry with every release:
|
|
313
|
-
|
|
314
|
-
```bash
|
|
315
|
-
docker run --rm ghcr.io/nodemaven/google-browser-scraper doctor
|
|
316
|
-
docker run --rm -p 8000:8000 -e GBS_API_KEY=change-me \
|
|
317
|
-
-e GBS_PROXY='http://USER-session-{session}:PASS@gate.example.com:7000' \
|
|
318
|
-
ghcr.io/nodemaven/google-browser-scraper serve --host 0.0.0.0
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
To build it yourself: `docker build -t google-browser-scraper .`
|
|
322
|
-
|
|
323
|
-
## How it works
|
|
324
|
-
|
|
325
|
-
1. **New identity:** a sticky proxy session and a fresh browser profile.
|
|
326
|
-
2. **Warm-up:** a few ordinary pages, staying on each for 20-45 seconds.
|
|
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.
|
|
335
|
-
|
|
336
|
-
<details>
|
|
337
|
-
<summary><b>More detail: HTTP between checks, holding proxy IPs, copied cookies, result links, traffic</b></summary>
|
|
338
|
-
|
|
339
|
-
<br>
|
|
340
|
-
|
|
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
|
|
350
|
-
pays for a warm-up, so a short cap mostly buys more warm-up traffic. Every 50
|
|
351
|
-
results pages it renders, the browser is restarted on the same profile and proxy IP, which keeps
|
|
352
|
-
its memory from growing over a long hold. A browser error on a search is retried
|
|
353
|
-
once on the same proxy IP before it is dropped; a network error, running out of
|
|
354
|
-
memory or a crashed browser drops it at once.
|
|
355
|
-
|
|
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,
|
|
358
|
-
instead of warming each one; all workers share the copy. Google's acceptance
|
|
359
|
-
follows the cookies more than the address, so a copy usually starts out served
|
|
360
|
-
and costs a few MB instead of a full warm-up. A copy waits 40-60 seconds after
|
|
361
|
-
its browser starts before the first search.
|
|
362
|
-
|
|
363
|
-
**Copying the cache.** Pages get cheaper as a proxy IP is held, because the
|
|
364
|
-
browser cache fills with Google's shared scripts and images. Copies carry that
|
|
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
|
|
367
|
-
copies carrying the cache are refused on their first search, the rest of the
|
|
368
|
-
run copies cookies only (`--no-clone-cache` does that from the start).
|
|
369
|
-
|
|
370
|
-
**Result links.** Google wraps result links in encrypted `/goto` redirects.
|
|
371
|
-
Each one is resolved with a small request through a separate short-lived proxy
|
|
372
|
-
session, a few at a time, in the background while the browser goes on to the
|
|
373
|
-
next query. Records still come out in the order each browser searched them.
|
|
374
|
-
|
|
375
|
-
**Traffic.** Everything goes through a small local relay that counts bytes per
|
|
376
|
-
host and blocks a large model download Chrome otherwise makes on every fresh
|
|
377
|
-
profile.
|
|
378
|
-
|
|
379
|
-
</details>
|
|
380
|
-
|
|
381
|
-
The defaults come from measurements in
|
|
382
|
-
[proxy-benchmark](https://github.com/nodemaven/proxy-benchmark).
|
|
383
|
-
|
|
384
|
-
## Options
|
|
385
|
-
|
|
386
|
-
<details>
|
|
387
|
-
<summary><b>All search options</b></summary>
|
|
388
|
-
|
|
389
|
-
<br>
|
|
390
|
-
|
|
391
|
-
| Option | Default | What it does |
|
|
392
|
-
|---|---|---|
|
|
393
|
-
| `--workers N` | 1 | Search on N proxy IPs at once, one browser each, from one list of queries |
|
|
394
|
-
| `--max-per-exit N` | 300 | Queries before a served proxy IP is retired |
|
|
395
|
-
| `--restart-every N` | 50 | Results pages the browser rendered before it restarts on the same profile and proxy IP; `0` never |
|
|
396
|
-
| `--no-hybrid` | | Fetch every results page in the browser instead of over HTTP between Google's checks |
|
|
397
|
-
| `--hl`, `--gl` | `en`, unset | Language and country of the results |
|
|
398
|
-
| `--clone N` | 10 | New proxy IPs started from copied cookies; `0` turns copying off |
|
|
399
|
-
| `--clone-max-age` | 180 | Minutes copied cookies stay in use |
|
|
400
|
-
| `--clone-refusals N` | 1 | Copies refused in a row on their first query that end the copying |
|
|
401
|
-
| `--no-clone-cache` | | Copies carry cookies only, not the browser cache |
|
|
402
|
-
| `--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` |
|
|
403
|
-
| `--spare N` | 0 | Proxy IPs warmed in the background so a retired one is replaced at once; each costs a warm-up |
|
|
404
|
-
| `--direct` | `all` | Open results pages directly: `all`, `follow-ups` (all but the first query on each proxy IP), `none` |
|
|
405
|
-
| `--input` | `type` | How a query goes into the search box: `type`, `insert`, `words` |
|
|
406
|
-
| `--gap LOW,HIGH` | 2,5 | Seconds between queries on one proxy IP |
|
|
407
|
-
| `--pages N` | 1 | Result pages per query |
|
|
408
|
-
| `--format` | `jsonl` | `jsonl` or `csv` |
|
|
409
|
-
| `--price-per-gb` | | Your proxy price, to print the cost per 1000 pages |
|
|
410
|
-
| `--no-resolve-links` | | Keep result links as Google `/goto` redirects |
|
|
411
|
-
| `--save-html DIR` | | Keep every page's HTML, gzipped |
|
|
412
|
-
|
|
413
|
-
`google-browser-scraper search --help` lists the rest.
|
|
414
|
-
|
|
415
|
-
</details>
|
|
416
|
-
|
|
417
|
-
## Proxies
|
|
418
|
-
|
|
419
|
-
Any provider with sticky sessions works through `--proxy` and a `{session}`
|
|
420
|
-
placeholder. A proxy without one is accepted with a warning: if the proxy IP changes
|
|
421
|
-
on every request, warming it does nothing. SOCKS5 needs an IP-whitelisted
|
|
422
|
-
endpoint, because Chrome cannot send a SOCKS5 username and password.
|
|
423
|
-
|
|
424
|
-
## Check your machine
|
|
425
|
-
|
|
426
|
-
```bash
|
|
427
|
-
google-browser-scraper doctor
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
Starts the browser on a blank page, sends nothing, and reports what a website
|
|
431
|
-
would see: whether the browser looks headless, whether WebGL works, the screen
|
|
432
|
-
size. Google answers some machines much less than others, so run this first.
|
|
433
|
-
|
|
434
|
-
## What this is not
|
|
435
|
-
|
|
436
|
-
Not a free Google Search API, and not a guarantee that every proxy IP will
|
|
437
|
-
work. It is a browser-based collector that makes failures explicit, drops proxy IPs
|
|
438
|
-
Google refuses, and tells you what each page cost.
|
|
439
|
-
|
|
440
|
-
## Status
|
|
441
|
-
|
|
442
|
-
Early. The `cloak` engine (`--engine cloak`) is experimental; `patchright` is
|
|
443
|
-
the default.
|
|
444
|
-
|
|
445
|
-
Google changes its pages often. If results come back empty or wrong, run with
|
|
446
|
-
`--save-html DIR` and open an issue with what you see.
|
|
447
|
-
|
|
448
|
-
You are responsible for using this within Google's terms and the law where you
|
|
449
|
-
run it.
|
|
450
|
-
|
|
451
|
-
## Adding an engine
|
|
452
|
-
|
|
453
|
-
An engine joins this tool only after it has been measured on
|
|
454
|
-
[proxy-benchmark](https://github.com/nodemaven/proxy-benchmark). Add it there
|
|
455
|
-
and run the warm-up ladder against Google:
|
|
456
|
-
|
|
457
|
-
```bash
|
|
458
|
-
python scripts/run_ladder.py --engines your-engine
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
Then open a pull request here with the run file. The ladder runs identities
|
|
462
|
-
with and without the warm-up in the same hours, so the result shows whether the
|
|
463
|
-
engine actually gets served, not whether it got lucky once.
|
|
464
|
-
|
|
465
|
-
## License
|
|
466
|
-
|
|
467
|
-
[MIT](https://github.com/nodemaven/google-browser-scraper/blob/main/LICENSE)
|