npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

google-search-scraper-api

v0.0.5

Published

Node.js client for scraping Google Search results using the ScrapingBee Google Search API.

Downloads

148

Readme

google-search-scraper-api

Scraping Google search results as JSON with Node.js

A Node.js client for scraping Google search results through the ScrapingBee Google Search API. Hands off the parts of google scraping that don't add product value, proxy rotation, headless rendering, anti-bot, SERP parsing, and returns clean JSON.

npm install google-search-scraper-api

You'll need a ScrapingBee API key. The free tier gives you 1,000 credits with no card required: scrapingbee.com.

Why use a Google Search Scraper API?

Anyone who has run a homegrown google search results scraper for more than a quarter knows the maintenance shape. Datacenter IPs work for a few hundred requests, then Google starts serving the consent wall. Residential proxies survive longer but cost more and need rotation logic. Headless browsers handle JS-rendered SERP features and AI Overviews, until Google rotates a layout and every CSS selector in your parser breaks at once.

A managed google search scraper api collapses that stack into one HTTP call. ScrapingBee runs the proxies (classic, premium residential, stealth), the headless browser pool, and a parser that tracks Google's SERP schema changes. You get a structured JSON response back from a single endpoint:

https://app.scrapingbee.com/api/v1/store/google

This package is a thin Node.js wrapper around that endpoint with camelCase options and a Promise-based interface, so calling code stays idiomatic to Node rather than translating snake_case query strings by hand.

Quick start

The official ScrapingBee Google API call in JavaScript:

const axios = require('axios');

axios.get('https://app.scrapingbee.com/api/v1/store/google', {
    params: {
        'api_key': 'YOUR-API-KEY',
        'search': 'pizza new york',
    }
}).then(function (response) {
    console.log(response);
})

The same call through this package:

const { GoogleSearchScraper } = require('google-search-scraper-api');

const scraper = new GoogleSearchScraper({ apiKey: 'YOUR-API-KEY' });

scraper.search({ query: 'pizza new york' }).then(function (response) {
    console.log(response);
});

Both hit the same endpoint and return the same JSON. The wrapper exists so options like country, device, and searchType are plain JavaScript fields rather than query-string parameters you have to remember the casing of.

API reference

new GoogleSearchScraper({ apiKey, timeout })

| Option | Type | Default | Description | | -------- | ------ | -------- | ------------------------------------ | | apiKey | string | required | Your ScrapingBee API key | | timeout| number | 60000 | Request timeout in milliseconds |

.search(options)

Every option below maps directly to a documented ScrapingBee Google Search API parameter. See the official reference for the canonical spec.

| Option | API parameter | Type | Default | Description | | -------------- | --------------- | ------- | --------- | -------------------------------------------------------------------------------------------- | | query | search | string | required | The search query | | country | country_code | string | us | ISO 3166-1 country code | | language | language | string | en | Results display language | | device | device | string | desktop | desktop or mobile | | page | page | integer | 1 | Results page number | | searchType | search_type | string | classic | classic, news, maps, images, lens, shopping, ai_mode | | lightRequest | light_request | boolean | true | true = 10 credits. false = 15 credits and unlocks AI Overviews + JS-rendered SERP fields. | | nfpr | nfpr | boolean | false | Disable Google's autocorrection | | addHtml | add_html | boolean | false | Include the raw full_html field in the response | | extraParams | extra_params | string | "" | Pass-through appended to the Google URL (e.g. &uule=…) |

Documented constraints:

  • searchType: 'news' is not available with device: 'mobile'
  • searchType: 'lens' only accepts image URLs as the query value
  • searchType: 'ai_mode' caps the query at 400 characters
  • AI Overviews require lightRequest: false

Response shape

Successful responses return an object with the following documented fields. Any given query will only populate the fields Google actually rendered — null-check before reading.

| Field | Description | | ----------------- | -------------------------------------------- | | meta_data | Query metadata and pagination info | | organic_results | Standard organic search results | | top_ads | Ads shown at the top of the SERP | | bottom_ads | Ads shown at the bottom of the SERP | | ai_overviews | AI-generated answer summary (when present) | | knowledge_graph | Knowledge panel data | | questions | People Also Ask questions and answers | | related_queries | Related search suggestions | | related_searches| "Searches related to" block | | top_stories | Top news stories carousel | | news_results | News results (when searchType: 'news') | | images | Image results (when searchType: 'images') | | local_results | Local business listings | | map_results | Map location results (when searchType: 'maps') | | hotel_results | Hotel listings |

Use cases

Common scenarios for a structured google search scraper api in a Node.js stack:

  • Rank tracking — feed a list of keywords through the scraper on a schedule, compare positions over time, surface ranking changes in a dashboard.
  • People Also Ask mining — collect the questions array across a seed list to build SERP-validated content briefs.
  • Brand monitoring — track when a brand appears in organic_results, news_results, or ai_overviews across geographies.
  • Local SEO snapshots — combine country + language + extraParams (UULE) for city-precision local SERPs across multiple markets.
  • News aggregationsearchType: 'news' returns Google News results with publication metadata for media monitoring.
  • AI / RAG retrievallightRequest: false unlocks ai_overviews and gives an LLM a fresh, structured grounding context for any query.
  • Ad intelligencetop_ads and bottom_ads expose competitor ad copy and landing pages.
  • Shopping researchsearchType: 'shopping' populates product-style results.

Each scenario uses the same .search() call with different option combinations — every option mapped to a documented ScrapingBee parameter listed above.

Pricing

ScrapingBee bills per successful API call:

  • Light request (default, lightRequest: true) — 10 credits per call
  • Regular request (lightRequest: false, required for AI Overviews) — 15 credits per call
  • Failed requests retry for up to 30 seconds before returning an error; failed calls are not charged

A $49/month plan provides 250,000 credits — roughly 25,000 light requests or 16,000 regular requests per month. Current rate card and plan tiers: scrapingbee.com/pricing.

FAQ

Is it legal to scrape Google search results?

Public SERP data is generally legal to collect in most jurisdictions, particularly for SEO research, brand monitoring, and competitive analysis. Personal data, copyrighted content, and login-walled material fall under different rules — check your local regulations and Google's terms before scaling. ScrapingBee's terms specifically prohibit scraping behind logins.

Why use this package instead of axios directly?

You can call the ScrapingBee endpoint with any HTTP client. This wrapper just gives you camelCase options, a typed apiKey constructor, and parameter validation so your editor autocompletes the option names. Functionally identical to a raw axios.get against the same endpoint.

What's the difference between lightRequest: true and lightRequest: false?

Light requests (the default) skip JavaScript rendering — they're fast, cheap (10 credits), and return organic results, questions, related searches, news, images, and maps. Regular requests (15 credits) render the page in a headless browser and unlock ai_overviews along with any other JS-injected SERP features Google rolls out.

How do I scrape google search results for a specific city?

Pass country for the country-level setting and extraParams: '&uule=…' for the city. UULE strings are encoded location identifiers; a number of small open-source libraries generate them.

Does this work in serverless environments (Lambda, Vercel, Cloudflare Workers)?

Yes. The only runtime dependency is axios. Works in any Node.js 14+ environment.

Can I track ranks past position 10?

Yes — increment the page option. Each page returns the next set of organic results.

How do I handle rate limits?

ScrapingBee caps concurrency per plan tier (10 / 50 / 100 / 200 depending on the plan). If you exceed it, the API returns a clear error — lower your concurrency rather than slowing per-request latency. Any standard Node.js concurrency limiter works.

What about Google Scholar, Google Trends, Google Flights?

This package targets the documented Google Search verticals: classic, news, maps, images, lens, shopping, ai_mode. Scholar, Trends, and Flights aren't part of the ScrapingBee Google Search API.

Documentation

License

MIT. See LICENSE.

Disclaimer

This is an unofficial Node.js wrapper around the ScrapingBee Google Search API. Not affiliated with ScrapingBee or Google. Compliance with Google's terms of service and applicable data-protection law is the responsibility of the operator.