Welcome to google-search-playwright’s documentation!¶
Google search from Python, powered by Playwright.
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. This package replaces that stack with a real
headless browser driven by Playwright so it keeps working against the current
Google search experience.
Usage¶
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)
from googlesearch import search, lucky
# "I'm feeling lucky"
first = lucky('python programming')
print(first)
Browser auto-detection¶
The library searches in this order:
Chromium/Chrome family via PATH.
Chromium/Chrome family at platform-specific paths (macOS, Windows).
Firefox via PATH.
Firefox at platform-specific paths.
You can override with search(..., browser_type="firefox", exe_path="/path").