GoogleSearch-Tool
GoogleSearch-Tool is a Python library for performing Google searches programmatically.
Uses Opera Mini User-Agent to bypass Google's JavaScript detection (Jan 2025+).
简体中文 | English
Features
- Web Search & News Search: Regular and news search support
- Automatic Pagination: Auto-fetch multiple pages via
startparameter - Proxy Support: Full proxy configuration
- Anti-Detection: Opera Mini User-Agent bypass, random domain rotation
Installation
pip install --upgrade googlesearch-tool
Requirements: Python 3.7+, httpx, beautifulsoup4
Quick Start
Basic Search
import asyncio
from googlesearch import search
async def main():
results = await search(term="python programming", num=10)
for r in results:
print(f"{r.title}")
print(f" {r.url}")
print(f" {r.description[:80]}...")
asyncio.run(main())
News Search
import asyncio
from googlesearch import search_news
async def main():
results = await search_news(term="artificial intelligence", num=5)
for r in results:
print(f"{r.title} - {r.url}")
asyncio.run(main())
Pagination (Resume Search)
# First page
page1 = await search(term="Python", num=10, start=0)
# Resume from position 10
page2 = await search(term="Python", num=10, start=10)
API Parameters
search() / search_news()
| Parameter | Description | Default |
|---|---|---|
term |
Search query | Required |
num |
Number of results | 10 |
lang |
Language code | "en" |
start |
Start position (pagination) | 0 |
proxy |
Proxy URL | None |
timeout |
Request timeout (seconds) | 10 |
sleep_interval |
Delay between requests | 0 |
deduplicate_results |
Remove duplicates | True |
SearchResult Object
| Property | Description |
|---|---|
url |
Result URL |
title |
Result title |
description |
Result description |
Advanced Usage
With Proxy
results = await search(
term="python",
num=10,
proxy="http://your-proxy:port"
)
Time Range Filter
results = await search(
term="python news",
tbs="qdr:d" # Past day
)
Time range options:
qdr:h- Past hourqdr:d- Past dayqdr:w- Past weekqdr:m- Past monthqdr:y- Past year
Site-Specific Search
results = await search(term="site:github.com python")
Reference
- Opera Mini UA bypass: deedy5/ddgs
License
MIT License
Release files for googlesearch-tool 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| googlesearch_tool-2.1.0.tar.gz | 11.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| googlesearch_tool-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.3 kB
Release files / googlesearch_tool-2.1.0.tar.gz
| Download URL | googlesearch_tool-2.1.0.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0953504f23e9ca1a0dfb54ccbf7d893aec85a37c9a34b9ecef1ad077d0582f69
|
|
BLAKE2b-256 checksum How to use checksums |
9618ac7d230e76ae5a0b1a290732c71913b9c5fd6df660e2a7591d961f004d9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 17, 2026.
Transparency logRelease files / googlesearch_tool-2.1.0-py3-none-any.whl
| Download URL | googlesearch_tool-2.1.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c523f26c9ee0cc6886a09adbc29145823505d0b0746ec028435af432883dbc2
|
|
BLAKE2b-256 checksum How to use checksums |
afdb417a8a0ecbe921a86cc0381348e57c114617fb4bfa2238a37ab5e8f11aa9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 17, 2026.
Transparency log