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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@schneehertz/google-it

v1.7.3

Published

A CLI and Node.js library to help retrieve, display, and store Google search results

Downloads

35

Readme

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 @schneehertz/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

  • [x] query - the query that should be sent to the Google search
  • [x] output - name of the JSON file to save results to
  • [x] no-display - prevent results from appearing in the terminal output. Should only be used with --output (-o) command when saving results to a file
  • [ ] save - name of the html file if you want to save the actual response from the html request (useful for debugging purposes)
  • [x] limit - number of search results to be returned
  • [x] only-urls - only display the URLs, instead of the titles and snippets
  • [ ] verbose - console.log useful statements to show what's currently taking place
  • [ ] interactive - once results are returned, show them in an interactive prompt where user can scroll through them
  • [ ] bold-matching-text - only takes effect when interactive (-i) flag is set as well, will bold test in results that matched the query
  • [x] includeSites - option to limit results to comma-separated list of sites
  • [x] excludeSites - option to exclude results that appear in comma-separated list of sites
  • [x] open - opens the first X number of results in the browser after finishing query
  • [x] disableConsole - intended to be used with programmatic use, so that the color-coded search results are not displayed in the terminal (via console.log) when not wanted.

Programmatic Use in NodeJS environment

const  googleIt = require('@schneehertz/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'
};
const additionalQueryParam = {
  lr: 'lang_zh-CN',
  cr: 'countryCN'
}
googleIt({options, 'query': 'covfefe irony', additionalQueryParam, disableConsole: true}).then(results => {
  // access to results object here
}).catch(e => {
  // any possible errors that might have occurred (like no Internet connection)
})