pevers / images-scraper

Simple and fast scraper for Google
ISC License
225 stars 70 forks source link

google.on('result', cb) not working #15

Closed DrSensor closed 7 years ago

DrSensor commented 7 years ago

try to listening event 'result'

var google = new Scraper.Google()
google.list({
    keyword: 'banana',
    num: 10
})

google.on('result', function(item) {
    console.log('result', item);
});

it doesn't output anything But when i try using bing it give me the result (from bing of course)

var bing = new Scraper.Bing()
bing.list({
    keyword: 'banana',
    num: 10
})

bing.on('result', function(item) {
    console.log('result', item);
});
gideonjones commented 7 years ago

I'm replicating this - not an issue for me as bing sufficient for my needs but just chiming in.

pevers commented 7 years ago

@cimenx Can you see what's happening when you enable the 'show: true' parameter? Maybe something is going on with Electron.

pevers commented 7 years ago

I'm wondering if this can be caused by a fresh Electron instance without cache. The first time it uses Google a 'Accept the policy' window appear that can possibly prevent the search.

pevers commented 7 years ago

Or it can be related to this: https://github.com/pevers/images-scraper/issues/11

If you are running this in a server environment