A Python library for performing Google searches with Opera Mini UA bypass
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file googlesearch_tool-2.0.0.tar.gz.
File metadata
- Download URL: googlesearch_tool-2.0.0.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
110f217c702ed70eb8eeea81a24e93e8032e9ec0fe80c805c0bf90b9a12e9a61
|
|
| MD5 |
a3db1a8f740770f216ff33d697a9c5fa
|
|
| BLAKE2b-256 |
a364be31934b05ce70c91d3aa716d7ce60e27ea691c5fabe24ad001d3e8bb9a2
|
Provenance
The following attestation bundles were made for googlesearch_tool-2.0.0.tar.gz:
Publisher:
publish.yml on huazz233/googlesearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
googlesearch_tool-2.0.0.tar.gz -
Subject digest:
110f217c702ed70eb8eeea81a24e93e8032e9ec0fe80c805c0bf90b9a12e9a61 - Sigstore transparency entry: 816709251
- Sigstore integration time:
-
Permalink:
huazz233/googlesearch@ca995bba20da389f4c9c915f4e887ab939ba7928 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/huazz233
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ca995bba20da389f4c9c915f4e887ab939ba7928 -
Trigger Event:
push
-
Statement type:
File details
Details for the file googlesearch_tool-2.0.0-py3-none-any.whl.
File metadata
- Download URL: googlesearch_tool-2.0.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f41ac67865db3d847fe88b727d3645343efe5460619a76ed18a20ed35d6130c4
|
|
| MD5 |
5622c503c05c838f542bfedfe49ef31c
|
|
| BLAKE2b-256 |
13ab924f1c1c3a0756ebc2164eae8b2f80b6b47c42282930a6d4299925d8caca
|
Provenance
The following attestation bundles were made for googlesearch_tool-2.0.0-py3-none-any.whl:
Publisher:
publish.yml on huazz233/googlesearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
googlesearch_tool-2.0.0-py3-none-any.whl -
Subject digest:
f41ac67865db3d847fe88b727d3645343efe5460619a76ed18a20ed35d6130c4 - Sigstore transparency entry: 816709326
- Sigstore integration time:
-
Permalink:
huazz233/googlesearch@ca995bba20da389f4c9c915f4e887ab939ba7928 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/huazz233
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ca995bba20da389f4c9c915f4e887ab939ba7928 -
Trigger Event:
push
-
Statement type: