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

google-sr

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-sr - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

dist/index.d.mts

97

dist/index.d.ts
import { AxiosRequestConfig } from 'axios';
import * as selectors from 'google-sr-selectors';
import { OrganicSearchSelector, TranslateSearchSelector, DictionarySearchSelector, TimeSearchSelector, CurrencyConvertSelector } from 'google-sr-selectors';
import { CheerioAPI } from 'cheerio';
interface SearchSelectors {
block: string;
link: string;
title: string;
description: string;
}
/**
* Selectors used for organic search
*/
interface SearchSelectors {
block: string;
link: string;
title: string;
description: string;
}
interface TranslateSelectors {
sourceLanguage: string;
targetLanguage: string;
translationText: string;
sourceText: string;
pronunciation: string;
}
/**
* Selectors used for Translations
*/
interface TranslateSelectors {
sourceLanguage: string;
targetLanguage: string;
translationText: string;
sourceText: string;
pronunciation: string;
}
interface DictionarySelectors {
audio: string;
phonetic: string;
word: string;
examples: string;
definitions: string;
}
interface TimeSelectors {
location: string;
time: string;
timeInWords: string;
}
interface CurrencySelectors {
from: string;
to: string;
}
declare enum ResultTypes {

@@ -176,23 +130,6 @@ SearchResult = "SEARCH",

*/
selectors: {
SearchNodes: SearchSelectors;
TranslateNodes: TranslateSelectors;
DictionaryNode: DictionarySelectors;
TimeNode: TimeSelectors;
CurrencyNode: CurrencySelectors;
};
selectors: typeof selectors;
}
declare const defaultOptions: SearchOptions;
/**
* Extract the actual webpage link from a href tag result
* @param googleLink
* @returns
*/
declare function extractUrlFromGoogleLink(googleLink: string): string | null;
/**
* Constructs the axios config by deep merging user provided config
*/
declare function constructSearchConfig(options: SearchOptions): AxiosRequestConfig;
/**
* Convert a normal page to google query page

@@ -255,4 +192,5 @@ */

* @returns
* @private
*/
declare function loadSearchNodes($: CheerioAPI, selectors: SearchSelectors): SearchResultNode[];
declare function loadSearchNodes($: CheerioAPI, selectors: typeof OrganicSearchSelector): SearchResultNode[];
/**

@@ -263,11 +201,26 @@ * Loader for translation blocks

* @returns
* @private
*/
declare function loadTranslateNodes($: CheerioAPI, selectors: TranslateSelectors): TranslateResultNode | null;
declare function loadTranslateNodes($: CheerioAPI, selectors: typeof TranslateSearchSelector): TranslateResultNode | null;
/**
* Loader for dictionary blocks
* @private
*/
declare function loadDictionaryNodes($: CheerioAPI, selectors: DictionarySelectors): DictionaryResultNode | null;
declare function loadTimeNode($: CheerioAPI, selectors: TimeSelectors): TimeResultNode | null;
declare function loadCurrencyNode($: CheerioAPI, selectors: CurrencySelectors): CurrencyResultNode | null;
declare function loadDictionaryNodes($: CheerioAPI, selectors: typeof DictionarySearchSelector): DictionaryResultNode | null;
/**
* @param $
* @param selectors
* @returns
* @private
*/
declare function loadTimeNode($: CheerioAPI, selectors: typeof TimeSearchSelector): TimeResultNode | null;
/**
*
* @param $
* @param selectors
* @returns
* @private
*/
declare function loadCurrencyNode($: CheerioAPI, selectors: typeof CurrencyConvertSelector): CurrencyResultNode | null;
export { CurrencyResultNode, CurrencySelectors, DictionaryResultNode, DictionarySelectors, ResultNode, ResultTypes, SearchOptions, SearchResultNode, SearchSelectors, TimeResultNode, TimeSelectors, TranslateResultNode, TranslateSelectors, constructSearchConfig, defaultOptions, extractUrlFromGoogleLink, generateArrayOfNumbers, loadCurrencyNode, loadDictionaryNodes, loadSearchNodes, loadTimeNode, loadTranslateNodes, pageToGoogleQueryPage, search, searchWithPages };
export { CurrencyResultNode, DictionaryResultNode, ResultNode, ResultTypes, SearchOptions, SearchResultNode, TimeResultNode, TranslateResultNode, generateArrayOfNumbers, loadCurrencyNode, loadDictionaryNodes, loadSearchNodes, loadTimeNode, loadTranslateNodes, pageToGoogleQueryPage, search, searchWithPages };

@@ -1,1 +0,301 @@

"use strict";var D=Object.create;var d=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var l=(e,t)=>d(e,"name",{value:t,configurable:!0});var k=(e,t)=>{for(var r in t)d(e,r,{get:t[r],enumerable:!0})},C=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of q(t))!L.call(e,o)&&o!==r&&d(e,o,{get:()=>t[o],enumerable:!(i=W(t,o))||i.enumerable});return e};var I=(e,t,r)=>(r=e!=null?D(B(e)):{},C(t||!e||!e.__esModule?d(r,"default",{value:e,enumerable:!0}):r,e)),Q=e=>C(d({},"__esModule",{value:!0}),e);var M={};k(M,{ResultTypes:()=>p,constructSearchConfig:()=>R,defaultOptions:()=>g,extractUrlFromGoogleLink:()=>m,generateArrayOfNumbers:()=>x,loadCurrencyNode:()=>A,loadDictionaryNodes:()=>S,loadSearchNodes:()=>y,loadTimeNode:()=>T,loadTranslateNodes:()=>N,pageToGoogleQueryPage:()=>h,search:()=>b,searchWithPages:()=>O});module.exports=Q(M);var p=(n=>(n.SearchResult="SEARCH",n.TranslateResult="TRANSLATE",n.DictionaryResult="DICTIONARY",n.TimeResult="TIME",n.CurrencyResult="CURRENCY",n))(p||{}),g={requestConfig:{},safeMode:!0,page:0,query:"",baseUrl:"https://www.google.com/search",filterResults:[],selectors:{SearchNodes:{block:".Gx5Zad.fP1Qef.xpd.EtOod.pkphOe",link:"[jsname][data-ved]",title:"h3.zBAuLc",description:".BNeawe.s3v9rd.AP7Wnd"},TranslateNodes:{sourceLanguage:"#tsuid_2 option:selected",targetLanguage:"#tsuid_4 option:selected",translationText:'[id="lrtl-translation-text"]',sourceText:'#lrtl-source-text input[name="tlitetxt"]',pronunciation:'[id="lrtl-transliteration-text"]'},DictionaryNode:{audio:"audio:first",phonetic:"span > div.BNeawe.tAd8D.AP7Wnd",word:"h3 > div.BNeawe.deIvCb.AP7Wnd",examples:"div.v9i61e > div.BNeawe > span.r0bn4c.rQMQod",definitions:"div.v9i61e > div.BNeawe.s3v9rd.AP7Wnd:not(:has(span.r0bn4c.rQMQod))"},TimeNode:{location:"span.BNeawe.tAd8D.AP7Wnd > span.r0bn4c.rQMQod",time:"div.BNeawe.iBp4i.AP7Wnd > div > div.BNeawe.iBp4i.AP7Wnd",timeInWords:"div.BNeawe.tAd8D.AP7Wnd > div > div.BNeawe.tAd8D.AP7Wnd"},CurrencyNode:{from:"span.BNeawe.tAd8D.AP7Wnd > span.r0bn4c.rQMQod",to:"div.BNeawe.iBp4i.AP7Wnd > div > div.BNeawe.iBp4i.AP7Wnd"}}};var f=require("deepmerge-ts");function m(e){let t=e.match(/\/url\?q=([^&]+)/);return t?decodeURIComponent(t[1]):null}l(m,"extractUrlFromGoogleLink");function R(e){let t=e.requestConfig||{headers:{}};t.headers=(0,f.deepmerge)({Accept:"text/html","Accept-Encoding":"gzip, deflate","Accept-Language":"en-US,en",Referer:"https://www.google.com/","upgrade-insecure-requests":1,"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"},t.headers||{});let r=new URLSearchParams(t.params??void 0);return r.append("gbv","1"),r.append("q",e.query),e.safeMode&&r.append("safe","active"),e.page&&r.append("start",e.page.toString()),(0,f.deepmerge)(t,{params:r,responseType:"text",responseEncoding:"utf-8"})}l(R,"constructSearchConfig");function h(e){return Math.max(e*10-10,0)}l(h,"pageToGoogleQueryPage");var x=l(e=>new Array(e).fill(0).map((t,r)=>r+1),"generateArrayOfNumbers");var w=I(require("axios")),v=require("cheerio");var P=require("deepmerge-ts");function y(e,t){let r=[];return e(t.block).each((i,o)=>{let n={type:"SEARCH"},c=e(o).find(t.link).attr("href"),a=e(o).find(t.description).text(),s=e(o).find(t.title).text();typeof s=="string"&&(n.title=s),typeof c=="string"&&(n.link=m(c)),typeof a=="string"&&(n.description=a),r.push(n)}),r}l(y,"loadSearchNodes");function N(e,t){let r=e(t.sourceLanguage).text().trim(),i=e(t.targetLanguage).text().trim(),o=e(t.translationText).text().trim(),n=e(t.sourceText).val(),c=e(t.pronunciation).text().trim();return[o,n,r,i].some(s=>s==="")?null:{type:"TRANSLATE",source:{language:r,text:n},translation:{language:i,text:o,pronunciation:c}}}l(N,"loadTranslateNodes");function S(e,t){let r=e(t.audio).attr("src"),i=e(t.phonetic).text().trim(),o=e(t.word).text().trim();if([r,i,o].some(a=>a===""))return null;let n=[];return e("div.v9i61e > div.BNeawe.s3v9rd.AP7Wnd:not(:has(span.r0bn4c.rQMQod))").each((a,s)=>{n[a]=["",""],n[a][0]=e(s).text().trim()}),e("div.v9i61e > div.BNeawe > span.r0bn4c.rQMQod").each((a,s)=>{if(n[a]){let u=e(s).text().trim();u.startsWith('"')&&(u=u.slice(1)),u.endsWith('"')&&(u=u.slice(0,u.length-1)),n[a][1]=u}}),{type:"DICTIONARY",audio:r,phonetic:i,word:o,definitions:n}}l(S,"loadDictionaryNodes");function T(e,t){let r=e(t.location).text().trim(),i=e(t.time).text().trim(),o=e(t.timeInWords).text().trim();return[r,i,o].some(c=>c==="")?null:{type:"TIME",location:r,time:i,timeInWords:o}}l(T,"loadTimeNode");function A(e,t){let r=e(t.from).text().trim(),i=e(t.to).text().trim(),o=`${r} ${i}`;return[i,r].some(c=>c==="")?null:{type:"CURRENCY",formula:o,from:r.replace("=",""),to:i}}l(A,"loadCurrencyNode");async function b(e){if(!e.query||typeof e.query!="string")throw new TypeError(`Search query must be a string, received ${typeof e.query}`);let t=(0,P.deepmerge)(g,e);t.filterResults.length===0&&(t.filterResults=["SEARCH"]);let r=R(t),o=(await w.default.get(t.baseUrl,r)).data,n=(0,v.load)(o),c=[],a=t.selectors;if(t.filterResults.includes("TRANSLATE")){let s=N(n,a.TranslateNodes);s&&c.push(s)}if(t.filterResults.includes("DICTIONARY")){let s=S(n,a.DictionaryNode);s&&c.push(s)}if(t.filterResults.includes("TIME")){let s=T(n,a.TimeNode);s&&c.push(s)}if(t.filterResults.includes("CURRENCY")){let s=A(n,a.CurrencyNode);s&&c.push(s)}if(t.filterResults.includes("SEARCH")){let s=y(n,a.SearchNodes);c.push(...s)}return c}l(b,"search");async function O({pages:e,...t}){let r=Array.isArray(e)?e:x(e),i=[];for(let o of r){t.page=h(o);let n=await b(t);i.push(n)}return i}l(O,"searchWithPages");0&&(module.exports={ResultTypes,constructSearchConfig,defaultOptions,extractUrlFromGoogleLink,generateArrayOfNumbers,loadCurrencyNode,loadDictionaryNodes,loadSearchNodes,loadTimeNode,loadTranslateNodes,pageToGoogleQueryPage,search,searchWithPages});
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
ResultTypes: () => ResultTypes,
generateArrayOfNumbers: () => generateArrayOfNumbers,
loadCurrencyNode: () => loadCurrencyNode,
loadDictionaryNodes: () => loadDictionaryNodes,
loadSearchNodes: () => loadSearchNodes,
loadTimeNode: () => loadTimeNode,
loadTranslateNodes: () => loadTranslateNodes,
pageToGoogleQueryPage: () => pageToGoogleQueryPage,
search: () => search,
searchWithPages: () => searchWithPages
});
module.exports = __toCommonJS(src_exports);
// src/constants.ts
var selectors = __toESM(require("google-sr-selectors"));
var ResultTypes = /* @__PURE__ */ ((ResultTypes2) => {
ResultTypes2["SearchResult"] = "SEARCH";
ResultTypes2["TranslateResult"] = "TRANSLATE";
ResultTypes2["DictionaryResult"] = "DICTIONARY";
ResultTypes2["TimeResult"] = "TIME";
ResultTypes2["CurrencyResult"] = "CURRENCY";
return ResultTypes2;
})(ResultTypes || {});
var defaultOptions = {
requestConfig: {},
safeMode: true,
// by default only the first page is resolved
page: 0,
query: "",
baseUrl: "https://www.google.com/search",
// do not add anything to this as deep merge will merge a new one with this
filterResults: [],
// these selectors must be updated when necessary
// last selector update was on 8/15/2023
selectors
};
// src/helpers.ts
var import_deepmerge_ts = require("deepmerge-ts");
function extractUrlFromGoogleLink(googleLink) {
const match = googleLink.match(/\/url\?q=([^&]+)/);
if (match) {
const decodedUrl = decodeURIComponent(match[1]);
return decodedUrl;
}
return null;
}
__name(extractUrlFromGoogleLink, "extractUrlFromGoogleLink");
function constructSearchConfig(options) {
const AxiosRequestOptions = options.requestConfig || { headers: {} };
AxiosRequestOptions.headers = (0, import_deepmerge_ts.deepmerge)(
{
Accept: "text/html",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en",
Referer: "https://www.google.com/",
"upgrade-insecure-requests": 1,
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"
},
AxiosRequestOptions.headers || {}
);
const params = new URLSearchParams(AxiosRequestOptions.params ?? void 0);
params.append("gbv", "1");
params.append("q", options.query);
if (options.safeMode) {
params.append("safe", "active");
}
if (options.page) {
params.append("start", options.page.toString());
}
const newConfig = {
params,
// require response data
responseType: "text",
responseEncoding: "utf-8"
};
return (0, import_deepmerge_ts.deepmerge)(AxiosRequestOptions, newConfig);
}
__name(constructSearchConfig, "constructSearchConfig");
function pageToGoogleQueryPage(page) {
return Math.max(page * 10 - 10, 0);
}
__name(pageToGoogleQueryPage, "pageToGoogleQueryPage");
var generateArrayOfNumbers = /* @__PURE__ */ __name((maxNumber) => new Array(maxNumber).fill(0).map((_, index) => index + 1), "generateArrayOfNumbers");
// src/search.ts
var import_axios = __toESM(require("axios"));
var import_cheerio = require("cheerio");
var import_deepmerge_ts2 = require("deepmerge-ts");
// src/loaders.ts
function loadSearchNodes($, selectors2) {
const parsedResults = [];
$(selectors2.block).each((_index, element) => {
const result = { type: "SEARCH" /* SearchResult */ };
const link = $(element).find(selectors2.link).attr("href");
const description = $(element).find(selectors2.description).text();
const title = $(element).find(selectors2.title).text();
if (typeof title === "string")
result.title = title;
if (typeof link === "string")
result.link = extractUrlFromGoogleLink(link);
if (typeof description === "string")
result.description = description;
parsedResults.push(result);
});
return parsedResults;
}
__name(loadSearchNodes, "loadSearchNodes");
function loadTranslateNodes($, selectors2) {
const sourceLanguage = $(selectors2.sourceLanguage).text().trim();
const targetLanguage = $(selectors2.targetLanguage).text().trim();
const translation = $(selectors2.translationText).text().trim();
const source = $(selectors2.sourceText).val();
const pronunciation = $(selectors2.pronunciation).text().trim();
if ([translation, source, sourceLanguage, targetLanguage].some(
(value) => value === ""
))
return null;
const result = {
type: "TRANSLATE" /* TranslateResult */,
source: {
language: sourceLanguage,
// expect this to be always a string
text: source
},
translation: {
language: targetLanguage,
text: translation,
pronunciation
}
};
return result;
}
__name(loadTranslateNodes, "loadTranslateNodes");
function loadDictionaryNodes($, selectors2) {
const audio = $(selectors2.audio).attr("src");
const phonetic = $(selectors2.phonetic).text().trim();
const word = $(selectors2.word).text().trim();
if ([audio, phonetic, word].some((val) => val === ""))
return null;
const definitions = [];
$("div.v9i61e > div.BNeawe.s3v9rd.AP7Wnd:not(:has(span.r0bn4c.rQMQod))").each(
(index, el) => {
definitions[index] = ["", ""];
definitions[index][0] = $(el).text().trim();
}
);
$("div.v9i61e > div.BNeawe > span.r0bn4c.rQMQod").each((index, el) => {
if (definitions[index]) {
let example = $(el).text().trim();
if (example.startsWith(`"`))
example = example.slice(1);
if (example.endsWith(`"`))
example = example.slice(0, example.length - 1);
definitions[index][1] = example;
}
});
const result = {
type: "DICTIONARY" /* DictionaryResult */,
audio,
phonetic,
word,
definitions
};
return result;
}
__name(loadDictionaryNodes, "loadDictionaryNodes");
function loadTimeNode($, selectors2) {
const location = $(selectors2.location).text().trim();
const time = $(selectors2.time).text().trim();
const timeInWords = $(selectors2.timeInWords).text().trim();
if ([location, time, timeInWords].some((val) => val === ""))
return null;
const result = {
type: "TIME" /* TimeResult */,
location,
time,
timeInWords
};
return result;
}
__name(loadTimeNode, "loadTimeNode");
function loadCurrencyNode($, selectors2) {
const from = $(selectors2.from).text().trim();
const to = $(selectors2.to).text().trim();
const formula = `${from} ${to}`;
if ([to, from].some((val) => val === ""))
return null;
const result = {
type: "CURRENCY" /* CurrencyResult */,
formula,
from: from.replace("=", ""),
to
};
return result;
}
__name(loadCurrencyNode, "loadCurrencyNode");
// src/search.ts
async function search(searchOptions) {
if (!searchOptions.query || typeof searchOptions.query !== "string")
throw new TypeError(
`Search query must be a string, received ${typeof searchOptions.query}`
);
const options = (0, import_deepmerge_ts2.deepmerge)(defaultOptions, searchOptions);
if (options.filterResults.length === 0)
options.filterResults = ["SEARCH" /* SearchResult */];
const searchQuery = constructSearchConfig(options);
const searchRequest = await import_axios.default.get(options.baseUrl, searchQuery);
const html = searchRequest.data;
const $ = (0, import_cheerio.load)(html);
const result = [];
const selectors2 = options.selectors;
if (options.filterResults.includes("TRANSLATE" /* TranslateResult */)) {
const translateResult = loadTranslateNodes($, selectors2.TranslateSearchSelector);
if (translateResult)
result.push(translateResult);
}
if (options.filterResults.includes("DICTIONARY" /* DictionaryResult */)) {
const dictionaryResult = loadDictionaryNodes($, selectors2.DictionarySearchSelector);
if (dictionaryResult)
result.push(dictionaryResult);
}
if (options.filterResults.includes("TIME" /* TimeResult */)) {
const timeResult = loadTimeNode($, selectors2.TimeSearchSelector);
if (timeResult)
result.push(timeResult);
}
if (options.filterResults.includes("CURRENCY" /* CurrencyResult */)) {
const CurrencyResult = loadCurrencyNode($, selectors2.CurrencyConvertSelector);
if (CurrencyResult)
result.push(CurrencyResult);
}
if (options.filterResults.includes("SEARCH" /* SearchResult */)) {
const searchResults = loadSearchNodes($, selectors2.OrganicSearchSelector);
result.push(...searchResults);
}
return result;
}
__name(search, "search");
async function searchWithPages({
pages,
...options
}) {
const queryPages = Array.isArray(pages) ? pages : generateArrayOfNumbers(pages);
const pagesResults = [];
for (const page of queryPages) {
options.page = pageToGoogleQueryPage(page);
const result = await search(options);
pagesResults.push(result);
}
return pagesResults;
}
__name(searchWithPages, "searchWithPages");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ResultTypes,
generateArrayOfNumbers,
loadCurrencyNode,
loadDictionaryNodes,
loadSearchNodes,
loadTimeNode,
loadTranslateNodes,
pageToGoogleQueryPage,
search,
searchWithPages
});
{
"name": "google-sr",
"version": "3.1.0",
"version": "3.2.0",
"description": "Fast and efficient Package for scraping Google search results without the need for an API key",
"repository": "typicalninja/google-sr",
"homepage": "https://typicalninja.github.io/google-sr/",
"homepage": "https://g-sr.vercel.app/google/sr",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.mjs",
"exports": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"keywords": [

@@ -25,3 +31,5 @@ "google-sr",

"cheerio": "1.0.0-rc.12",
"deepmerge-ts": "^5.1.0"
"deepmerge-ts": "^5.1.0",
"tslib": "^2.6.1",
"google-sr-selectors": "^0.0.1"
},

@@ -39,6 +47,4 @@ "devDependencies": {

"test": "mocha --require ts-node/register tests/*.ts",
"build": "tsup",
"dev": "ts-node",
"pre:scrape": "node scraper/prescrape.js"
"build": "tsup"
}
}

@@ -44,6 +44,4 @@ # google-sr 🔍

# Usage
## Usage
### Simple example
You can easily perform a single-page search like this:

@@ -63,2 +61,3 @@

> By default only **ResultTypes.SearchResult** are returned, use the [filterResults](https://typicalninja.github.io/google-sr/advanced.html#filtering-result) option to configure it

@@ -70,9 +69,15 @@ > **More detailed examples & usage can be found [here](https://typicalninja.github.io/google-sr#usage)**

# Disclaimer
## Disclaimer
This is not sponsored, supported, or affiliated with Google Inc.
`The module scrapes the google search result page instead of using the API as suggested by google. Author is **NOT** responsible for any issue (ip block from google, etc...) that occurs due to misuse.
Unlike the conventional recommendation of using the Google API, this module scrapes the Google search result page (which might potentially infringe upon Google's terms of service).
The source code within this repository is intended solely for educational purposes.
The author (typicalninja) & contributors takes **no** responsibility for any issues that arise from misuse, such as IP blocking by Google. Your discretion in usage is advised.
## Related projects
* [google-that](https://github.com/typicalninja/google-sr/tree/master/packages/google-that) - CLI wrapper around google-sr
# Tests

@@ -90,3 +95,3 @@

# Support & Bug Reporting 🛠️🐞
## Support & Bug Reporting 🛠️🐞

@@ -97,4 +102,4 @@ > Make sure you are on the latest version before creating bug reports

# License
## License
This repository and the code inside it is licensed under the Apache-2.0 License. Read [LICENSE](./LICENSE) for more information.
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