Skip to main content

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+).

PyPI version GitHub license

简体中文 | English

Features

  • Web Search & News Search: Regular and news search support
  • Automatic Pagination: Auto-fetch multiple pages via start parameter
  • 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 hour
  • qdr:d - Past day
  • qdr:w - Past week
  • qdr:m - Past month
  • qdr:y - Past year

Site-Specific Search

results = await search(term="site:github.com python")

Reference

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

googlesearch_tool-2.0.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

googlesearch_tool-2.0.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

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

Hashes for googlesearch_tool-2.0.0.tar.gz
Algorithm Hash digest
SHA256 110f217c702ed70eb8eeea81a24e93e8032e9ec0fe80c805c0bf90b9a12e9a61
MD5 a3db1a8f740770f216ff33d697a9c5fa
BLAKE2b-256 a364be31934b05ce70c91d3aa716d7ce60e27ea691c5fabe24ad001d3e8bb9a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for googlesearch_tool-2.0.0.tar.gz:

Publisher: publish.yml on huazz233/googlesearch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file googlesearch_tool-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for googlesearch_tool-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f41ac67865db3d847fe88b727d3645343efe5460619a76ed18a20ed35d6130c4
MD5 5622c503c05c838f542bfedfe49ef31c
BLAKE2b-256 13ab924f1c1c3a0756ebc2164eae8b2f80b6b47c42282930a6d4299925d8caca

See more details on using hashes here.

Provenance

The following attestation bundles were made for googlesearch_tool-2.0.0-py3-none-any.whl:

Publisher: publish.yml on huazz233/googlesearch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page