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.1.0.tar.gz (11.7 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.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file googlesearch_tool-2.1.0.tar.gz.

File metadata

  • Download URL: googlesearch_tool-2.1.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for googlesearch_tool-2.1.0.tar.gz
Algorithm Hash digest
SHA256 0953504f23e9ca1a0dfb54ccbf7d893aec85a37c9a34b9ecef1ad077d0582f69
MD5 6528ff0cd3724416b22431052d4659f6
BLAKE2b-256 9618ac7d230e76ae5a0b1a290732c71913b9c5fd6df660e2a7591d961f004d9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for googlesearch_tool-2.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for googlesearch_tool-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c523f26c9ee0cc6886a09adbc29145823505d0b0746ec028435af432883dbc2
MD5 ebefeb5c4570cb7dc3e13ee77c3625d9
BLAKE2b-256 afdb417a8a0ecbe921a86cc0381348e57c114617fb4bfa2238a37ab5e8f11aa9

See more details on using hashes here.

Provenance

The following attestation bundles were made for googlesearch_tool-2.1.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