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
- 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
pip install --upgrade googlesearch-toolRequirements: Python 3.7+, httpx, beautifulsoup4
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())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())# First page
page1 = await search(term="Python", num=10, start=0)
# Resume from position 10
page2 = await search(term="Python", num=10, start=10)| 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 |
| Property | Description |
|---|---|
url |
Result URL |
title |
Result title |
description |
Result description |
results = await search(
term="python",
num=10,
proxy="http://your-proxy:port"
)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
results = await search(term="site:github.com python")- Opera Mini UA bypass: deedy5/ddgs
MIT License