Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-sr

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-sr

Fast and efficient Package for scraping Google search results without the need for an API key

  • 4.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3K
increased by92.9%
Maintainers
0
Weekly downloads
 
Created
Source

google-sr 🔍

testing workflow npm downloads GitHub issues NPM npm version Discord CodeFactor

Simple & Fast Package for scraping Google search results without the need for an API key. 🚀

Features

Install 📦

Runtime Support

google-sr does not support web environments, but it has been tested and confirmed to work on the following runtimes:

To get started, you can install google-sr using your preferred package manager:

npm install google-sr
# For pnpm/yarn/bun:
pnpm/yarn/bun add google-sr
# For Deno, either use the npm: specifier
# or import from esm.sh
# https://esm.sh/google-sr

Usage

This example demonstrates some of the features of google-sr. For a bare minimum setup, refer to the examples/basic file.

import {
  search,
  OrganicResult, // Import the result types you need
  DictionaryResult,
  ResultTypes, // Import to filter results by type
} from "google-sr";

const queryResult = await search({
  query: "nodejs",
  // Specify the result types explicitly ([OrganicResult] is the default, but it is recommended to always specify the result type)
  resultTypes: [OrganicResult, DictionaryResult],
  // Optional: Customize the request using AxiosRequestConfig (e.g., enabling safe search)
  requestConfig: {
    params: {
      safe: "active",   // Enable "safe mode"
    },
  },
});

// will return a SearchResult[]
console.log(queryResult);
console.log(queryResult[0].type === ResultTypes.OrganicResult); // true

Note: By default, only results of type ResultTypes.OrganicResult are returned. Use the resultTypes option to customize the output.

google-sr API

Please refer to the google-sr API here

Disclaimer

This is not sponsored, supported, or affiliated with Google.

The source code within this repository is intended solely for educational & research purposes. The author (typicalninja) & contributors takes NO responsibility for any issues that arise from its use, such as IP blocking by Google. Your discretion in usage is advised.

Tests

Tests are written using vitest and can be run by using the test script.

Weekly tests are executed using a github action to ensure compatibility and catch breakage due to google changes

pnpm run test

License

This repository and the code inside it is licensed under the Apache-2.0 License. Read LICENSE for more information.

Keywords

FAQs

Package last updated on 16 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc