Skip to main content

Unofficial Python bindings to the Google search engine using Playwright. Not affiliated with Google.

Project description

Google Search (Playwright)

Google search from Python, powered by Playwright.

Note: this project is not affiliated with Google in any way.

Why this fork?

Google's web search interface now requires JavaScript for most requests, which broke the classic urllib + BeautifulSoup scraping used by the original googlesearch library (pip install google). This package replaces that stack with a real headless browser driven by Playwright, so it keeps working against the current Google search experience.

Usage example

from googlesearch import search

# Get the first 20 hits for: "Breaking Code" WordPress blog
for url in search('"Breaking Code" WordPress blog', stop=20):
    print(url)

More examples:

from googlesearch import search, lucky

# "I'm feeling lucky"
first = lucky('python programming')
print(first)  # https://www.python.org/

# Limit to recent results
for url in search('latest news', stop=10):
    print(url)

Requirements

  • Python 3.8+
  • A Chromium, Chrome, Chrome-based (e.g. Microsoft Edge), or Firefox browser installed on your system. No Playwright browser downloads are needed.

The browser is found automatically. See find_browser() for the search order.

Installing

pip install google-search-playwright

Command-line usage

A google console script is provided:

google "python programming" --stop 5
google "linux kernel" --browser chromium

Run google --help for all options.

Browser auto-detection

The library searches in this order:

  1. Chromium/Chrome family via PATH: chromium, chromium-browser, google-chrome, google-chrome-stable, chrome, chrom, microsoft-edge, edge.
  2. Chromium/Chrome family at platform-specific paths (macOS .app bundles, Windows Program Files).
  3. Firefox via PATH: firefox, firefox-esr, firefox-nightly.
  4. Firefox at platform-specific paths.

You can override this with search(..., browser_type="firefox", exe_path="/path").

API reference

This documentation is generated from the source via Sphinx:

https://python-googlesearch.readthedocs.io/en/latest/

License

BSD 3-Clause. See 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

google_search_playwright-4.0.1.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

google_search_playwright-4.0.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file google_search_playwright-4.0.1.tar.gz.

File metadata

  • Download URL: google_search_playwright-4.0.1.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for google_search_playwright-4.0.1.tar.gz
Algorithm Hash digest
SHA256 58146afed1a4e084552c85050a5f9784150ca0be3ba01ca0d0d6c545bb30254e
MD5 404ca857001475d1209e13a2ffa16a1a
BLAKE2b-256 9d265f8013371317df6864c0755b8b7d949a06c89a5b52676b8973e974a77a7f

See more details on using hashes here.

File details

Details for the file google_search_playwright-4.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for google_search_playwright-4.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ec1ae1494edc7157969a8c438d80cacb1e1f149f7fdbe0d1817b33f28df399f3
MD5 d2691098e79dae2f8f347db51db0ffb1
BLAKE2b-256 276bec3d9119e225ecf06006b871fd878777a595fd63053af5952eee7a4314f3

See more details on using hashes here.

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