<commit_before># google-images-scraper
Simple and fast scraper for Google images using Nightmare. A rate limiter is implemented and can be used to prevent bans.

# Installation
```npm install google-images-scraper```

# Example
Give me the first 10 images of Banana's

```js
var Scraper = require('./google-images-scraper');

var scraper = new Scraper({
	keyword: 'banana',
	rlimit: 10	// 10 p second
});

scraper.list(10).then(function (res) {
	console.log(res);
});
```

Will output:

```
[ 'https://www.organicfacts.net/wp-content/uploads/2013/05/Banana21.jpg',
  'http://www.bbcgoodfood.com/sites/default/files/glossary/banana-crop.jpg',
  'http://dreamatico.com/data_images/banana/banana-3.jpg',
  'https://upload.wikimedia.org/wikipedia/commons/4/4c/Bananas.jpg',
  'http://pngimg.com/upload/banana_PNG835.png',
  'http://globe-views.com/dcim/dreams/bananas/bananas-03.jpg',
  'http://i.huffpost.com/gen/1553496/images/o-BANANA-facebook.jpg',
  'http://fitnessandhealthadvisor.com/wp-content/uploads/2013/05/bananas1.jpeg',
  'http://i.telegraph.co.uk/multimedia/archive/03120/banana_3120781b.jpg',
  'http://cdn1.medicalnewstoday.com/content/images/articles/271157-bananas.jpg' ]

```

Another example to use the request and fs module to write the image to output:

```js
var Scraper = require('./google-images-scraper')
  , fs = require('fs')
  , request = require('request');

var scraper = new Scraper({
	keyword: 'banana',
	rlimit: 10	// 10 p second
});

scraper.list(10).then(function (res) {
	console.log('first 10 results', res);

	res.forEach(function(r) {
		var file = r.split('/');
		var r = request(r).pipe(fs.createWriteStream(file[file.length-1]));
	});
});
```

#Options
Options that can be passed to google-images-scraper:

```js
var options = {
	keyword: 'keyword' // required,
	rlimit: '10',	// number of requests to Google p second (can be 0 for unlimited)<commit_msg>minor layout fix<commit_after># google-images-scraper
Simple and fast scraper for Google images using Nightmare. A rate limiter is implemented and can be used to prevent bans.

# Installation
```npm install google-images-scraper```

# Example
Give me the first 10 images of Banana's

```js
var Scraper = require('./google-images-scraper');

var scraper = new Scraper({
	keyword: 'banana',
	rlimit: 10	// 10 p second
});

scraper.list(10).then(function (res) {
	console.log(res);
});
```

Will output:

```
[ 'https://www.organicfacts.net/wp-content/uploads/2013/05/Banana21.jpg',
  'http://www.bbcgoodfood.com/sites/default/files/glossary/banana-crop.jpg',
  'http://dreamatico.com/data_images/banana/banana-3.jpg',
  'https://upload.wikimedia.org/wikipedia/commons/4/4c/Bananas.jpg',
  'http://pngimg.com/upload/banana_PNG835.png',
  'http://globe-views.com/dcim/dreams/bananas/bananas-03.jpg',
  'http://i.huffpost.com/gen/1553496/images/o-BANANA-facebook.jpg',
  'http://fitnessandhealthadvisor.com/wp-content/uploads/2013/05/bananas1.jpeg',
  'http://i.telegraph.co.uk/multimedia/archive/03120/banana_3120781b.jpg',
  'http://cdn1.medicalnewstoday.com/content/images/articles/271157-bananas.jpg' ]

```

Another example to use the request and fs module to write the image to output:

```js
var Scraper = require('./google-images-scraper')
  , fs = require('fs')
  , request = require('request');

var scraper = new Scraper({
	keyword: 'banana',
	rlimit: 10	// 10 p second
});

scraper.list(10).then(function (res) {
	console.log('first 10 results', res);

	res.forEach(function(r) {
		var file = r.split('/');
		var r = request(r).pipe(fs.createWriteStream(file[file.length-1]));
	});
});
```

# Options
Options that can be passed to google-images-scraper:

```js
var options = {
	keyword: 'keyword' // required,
	rlimit: '10',	// number of requests to Google p second (can be 0 for unlimited)
{'fraction_non_alphanumeric': 0.16939313984168866, 'fraction_numerical': 0.03641160949868074, 'mean_word_length': 4.279944289693593, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4165588', 'n_tokens_mistral': 1518, 'n_tokens_neox': 1369, 'n_words': 283}