Skip to main content

this pip package is meant to scrape and parse Google results using SERP API. Feel free to fork this repository to add more backends.

Project description

# Google Search Results in Python

This Python package is meant to scrape and parse Google results using [SERP API](https://serpapi.com). Feel free to fork this repository to add more backends.

## Simple Example
```python
from lib.google_search_results import GoogleSearchResults
query = GoogleSearchResults({"q": "coffee"})
html_results = query.get_html()
```

## Set SERP API key

```python
GoogleSearchResults.SERP_API_KEY = "Your Private Key"
```
Or
```python
query = GoogleSearchResults({"q": "coffee", "serp_api_key": "Your Private Key"})
```

## Example with all params and all outputs

```python
query_params = {
"q": "query",
"google_domain": "Google Domain",
"location": "Location Requested",
"device": device,
"hl": "Google UI Language",
"gl": "Google Country",
"safe": "Safe Search Flag",
"num": "Number of Results",
"start": "Pagination Offset",
"serp_api_key": "Your SERP API Key"
}

query = GoogleSearchResults[query_params]
query.params_dict["location"] = "Portland"

html_results = query.get_html()
dictionary_results = query.get_dictionary()
dictionary_results_with_images = query.get_dictionary_with_images()
json_results = query.get_json()
json_results_with_images = query.get_json_with_images()
```

## Example of Python Dictionary Output (GoogleSearchResults#get_dictionary)

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_results-1.1.2.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file google_search_results-1.1.2.tar.gz.

File metadata

File hashes

Hashes for google_search_results-1.1.2.tar.gz
Algorithm Hash digest
SHA256 486d6c00bb22f316cdccafc1defa819cef6fafcf783b735a4467d04fb644615c
MD5 ab14309d717609e1ff322d0364d71fb1
BLAKE2b-256 d41f1ffe051c5e27964248f8cd7cbc4d48c672a7b624c40fcd03ebc59a0ae3f8

See more details on using hashes here.

Supported by

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