Giter Club home page Giter Club logo

google-images's Introduction

google-images

Build Status Coverage Status

This module for Node.js helps searching images using Google Images. It provides just one method, search, simplicity FTW.

Installation

$ npm install google-images --save

Usage

Note: You'll need to set up your own Google Custom Search Engine to search for images.

const googleImages = require('google-images');

let client = googleImages('CSE ID', 'API KEY');

client.search('Steve Angello')
	.then(function (images) {
		/*
		[{
			"url": "http://steveangello.com/boss.jpg",
			"type": "image/jpeg",
			"width": 1024,
			"height": 768,
			"size": 102451,
			"thumbnail": {
				"url": "http://steveangello.com/thumbnail.jpg",
				"width": 512,
				"height": 512
			}
		}]
		 */
	});

// paginate results
client.search('Steve Angello', {
	page: 2
});

// search for certain size
client.search('Steve Angello', {
	size: 'large'
});

Set up Google Custom Search Engine

Google deprecated their public Google Images API, so to search for images 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":

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 © Vadym Demedes

google-images's People

Contributors

unixpickle avatar davidyen1124 avatar mkazantsev avatar mingstar avatar

Watchers

James Cloos avatar eric o avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.