Skip to content
Snippets Groups Projects

Get number of Google results

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Frank Sauerburger

    Small python snippet to retrieve the estimated number of search results.

    Edited
    google_results.py 286 B
    import requests
    import re
    
    def get_n_results(query):
        response = requests.get("https://google.com/search?q=%s&hl=en" % query, headers={"Accept-Language": "en-US,en;q=0.5"})
        match = re.search("About ([\d.]+) results", response.text)
        return int(match.group(1).replace(".", ""))
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment