Skip to content

serpapi/google-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 

Repository files navigation

Google Scraper tool

Google Scraper

Scrape Google with a simple API. It includes Google Search, Google Maps, Google Shopping, and more!

We return the results in a nice, structured JSON. No more parsing, coding, proxy, or other web scraping headaches for developers.

Google Scraper Playground example

How to scrape Google?

Using a simple GET request, you can access all Google search engine results:

https://serpapi.com/search.json?q=Coffee&engine=google&api_key=YOUR_API_KEY
  • Register for free at SerpApi and get your API Key
  • Endpoint: https://serpapi.com/search.json
  • If you don't define the engine, it defaults to google. You can replace the value with any engine you need. For example, google_maps for Google Maps scraper.
  • Each of this engine have many optional parameters to refine your search.

Available Google Search Engines

We provide different engines, like:

  • Google Search API
  • Google Maps API || Google Maps Scraper
  • Google Maps Reviews API || Google Maps Reviews Scraper
  • Google Shopping API
  • Google Images API
  • Google Videos API
  • Google News API
  • Google Autocomplete API
  • Google Local API
  • Google Scholar API
  • Google Trends API
  • Google AI Overview API
  • Google AI Mode API
  • Google Flights API
  • Google Lens API
  • Google Events API
  • Google Hotels API
  • Google Reverse Image API
  • Google Finance API
  • Google Patents API
  • and more!

Code examples

Here are some code examples based on your favorite programming languages.

cURL Integration

curl --get https://serpapi.com/search \
 -d q="Coffee" \
 -d location="Austin,+Texas,+United+States" \
 -d hl="en" \
 -d gl="us" \
 -d google_domain="google.com" \
 -d api_key="secret_api_key"

Python Integration

Preparation for accessing the SerpApi API in Python

Step 1:
Create a new main.py file. (You can name it whatever you want)

Step 2:
Install requests package with:

pip install requests

Step 3:
Add this code to your file:

import requests
SERPAPI_API_KEY = "YOUR_REAL_SERPAPI_API_KEY"

params = {
    "api_key": SERPAPI_API_KEY, #replace with your real API Key
    # soon
}

search = requests.get("https://serpapi.com/search", params=params)
response = search.json()
print(response)

With these few lines of code, we can access all of the search engines available at SerpApi, including the Google Search API.

Step 4:
Here is how to scrape "Google Search" results.

import requests
SERPAPI_API_KEY = "YOUR_SERPAPI_API_KEY"

params = {
    "api_key": SERPAPI_API_KEY, 
    "engine": "google",
    "q": "coffee"
}

search = requests.get("https://serpapi.com/search", params=params)
response = search.json()
print(response)

JavaScript Integration

Step 1:
Install the SerpApi JavaScript package:

npm install serpapi

Step 2:
Create a new index.js file. (You can name it whatever you want)

Step 3:
Add this to your file for basic search:

const { getJson } = require("serpapi");
getJson({
  api_key: API_KEY, // Put your API Key
  engine: "google",
  q: "coffee"
}, (json) => {
  console.log(json["organic_results"]);
});

We're printing the organic_results from Google Search in this case.

Other Programming Languages

While you can use our APIs using a simple GET request with any programming language, you can also see our ready-to-use libraries here: SerpApi Integrations.

Blog tutorial

Video tutorial

Nocode method

We also offer no-code solutions for scraping Google.

Contacts

Feel free to reach out via [email protected].

About

Scrape Google using a simple API that includes Google Search, Google Maps, Google Shopping, and more!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published