forked from pevers/images-scraper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
60 lines (54 loc) · 1.21 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
'use strict'
var Scraper = require ('./index')
, google = new Scraper.Google()
, bing = new Scraper.Bing()
, pics = new Scraper.Picsearch()
, yahoo = new Scraper.Yahoo();
// will take ALOT of time if num=undefined
google.list({
keyword: 'coca cola',
num: 10,
detail: true,
nightmare: {
show: true
},
advanced: {
imgType: 'photo', // options: clipart, face, lineart, news, photo
resolution: undefined, // options: l(arge), m(edium), i(cons), etc.
color: undefined // options: color, gray, trans
}
})
.then(function (res) {
console.log('first 10 results from google', res);
}).catch(function(err) {
console.log('err',err);
});
// listening on events is also possible
google.on('result', function(item) {
console.log('result', item);
});
bing.list({
keyword: 'banana',
num: 10
})
.then(function (res) {
console.log('first 10 results from bing', res);
}).catch(function(err) {
console.log('err',err);
});
pics.list({
keyword: 'banana',
num: 10,
}).then(function (res) {
console.log('out',res);
}).catch(function (err) {
console.log('err',err);
});
yahoo.list({
keyword: 'banana',
num: 10,
}).then(function (res) {
console.log('results', res);
}).catch(function (err) {
console.log('err',err);
});