google-images
Provides a method in Node.js for searching Google Images.
Installation
$ npm install google-ims --save
Usage
Note: You'll need to set up your own Google Custom Search Engine to search for images.
See Google's page on CSE parameters for more info on the options. Example of using all available current options:
'use strict' // need this for 'let' to work const googleIms = ; let client = ; client; /* output will look like this: [ { type: 'image/png', width: 620, height: 349, size: 621748, url: 'http://www.stuff.co.nz/content/dam/images/1/b/4/w/i/b/image.related.StuffLandscapeSixteenByNine.620x349.1b5jgj.png/1461229326837.png', thumbnail: { url: 'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcR5jJP-Opup26AynNIJYrcgKYVLFCC3jWwCI_auwCUOopybFPL9_l1VOm6r', width: 136, height: 77 } } ] */
Set up Google Custom Search Engine
You need to sign up for Google Custom Search Engine. Here are the steps you need to do:
1. Create a Google Custom Search Engine
You can do this here: https://cse.google.com/cse.
Do not specify any sites to search but instead use the "Restrict Pages using Schema.org Types" under the "Advanced options".
For the most inclusive set, use the Schema: Thing
. Make a note of the CSE ID.
2. Enable Image Search
In your search engine settings, enable "Image search":
![](https://raw.githubusercontent.com/nategeorge/google-ims/HEAD/media/screenshot.png)
3. Set up a Google Custom Search Engine API
Register a new app and enable Google Custom Search Engine API here: Google Developers Console. Make a note of the API key.
Tests
$ npm test
License
MIT
Origin
Originally from https://github.com/vdemedes/google-images, but I wanted to add in some functionality that vdemedes didn't want to.