New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

google-serp

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

google-serp

Scrape Google search results with headless browser

unpublished
latest
Source
npmnpm
Version
0.1.10
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Google-serp

Scrape Google search results using Phobetor and Nightmare.js

How to use it?

// yarn add google-serp
const googleSerp = require("google-serp")
const serpResults = googleSerp({
  query:"Led Zeppelin"
}).then(console.log)

Output:

{
  type:"result",
  payload:[
    {
      url:"https://ledzeppelin.com",
      title: "Homepage of one rock and blues legend",
      description:"Led Zeppelin is not a misic you will easily forget",
      position: 1
    },
    ...
  ]
}

Typing

type SerpResult = {
  url: String,
  title: String,
  description: String,
  position: Number,
}

type Result = {
  payload:Array<SerpResult> | Error,
  type: "result" | "error"
}

googleSerp({
  query: String,
  showHundredFlag?: Boolean,
  show?: Boolean,
}): Promise<Result>

If there is an error during scraping, the library will return Object with type equal to "error" and the error as a payload. If process is successful, the library will return Object with type equal to "result" and array of results as payload .

Arguments

  • query

Google search query

  • scrapeHundredFlag

If set to true, it will request 100 search result instead of 10

Default value - false

  • show

If set to true, it will show the browser

Default value - false

Requirements

Electron compatible environment, i.e. either system with graphic interface or you need to use xvfb. In the latter case you need to do something like that https://gist.github.com/omarusman/1af968d9b96fc5b0cd39599db3f2b9bd

Changelog

  • 0.1.7 fix error occuring when there is element with no description
  • 0.1.6 fix error with exporting unexisting file in v0.1.5

FAQs

Package last updated on 22 Jun 2017

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