PatNeedham / google-it

command line Google search and save to JSON
104 stars 35 forks source link

google-it Build Status npm version Codecov Coverage Maintainability

A simple library to convert Google search results to JSON output, with an interactive display option coming in the near future.

Install

$ npm install --save -g google-it

Example Usage

$ google-it --query="Latvian unicorn"

GIF of google-it

Prevent display in the terminal, and save results to a JSON file:

$ google-it --query="PWAs with react-router and redux" -o results.json -n

GIF of google-it w/o display, results saved to file

$ google-it --query="open whisper systems" -O 5

GIF of opening-in-browser

$ google-it --query="mechanical turk" --only-urls

Screenshot of only-urls option

Command Line Arguments

Programmatic Use in NodeJS environment

const  googleIt = require('google-it')

googleIt({'query': 'covfefe irony'}).then(results => {
  // access to results object here
}).catch(e => {
  // any possible errors that might have occurred (like no Internet connection)
})

// with request options
const options = {
  'proxy': 'http://localhost:8118'
};
googleIt({options, 'query': 'covfefe irony'}).then(results => {
  // access to results object here
}).catch(e => {
  // any possible errors that might have occurred (like no Internet connection)
})