Thursday, 16 March 2017

error while returning URL from node js

i'm using this snippet to make google search starting to a given name:

var parseXlsx = require('excel');
var scraper = require('google-search-scraper');

parseXlsx('foo.xlsx', function(err, data) {
  if(err) throw err;
    // data is an array of arrays
    for(var i=1; i<5; i++){
        var stringToSearch = data[i][0];
        var options = {
            query: stringToSearch,
            limit: 1
        };
        scraper.search(options, function(err, url) {
            // This is called for each result
            if(err) throw err;
            console.log(url)
        });
    }
});

In foo.xlsx file i have this column:

name1
name2
name3
....

i'm getting always this error, and i don't know why:

Error: Captcha
    at Request._callback (C:\Users\user\node_modules\google-search-scraper\index.js:68:23)
    at Request.self.callback (C:\Users\user\node_modules\google-search-scraper\node_modules\request\request.js:122:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (C:\Users\user\node_modules\google-search-scraper\node_modules\request\request.js:888:14)
    at emitOne (events.js:101:20)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (C:\Users\user\node_modules\google-search-scraper\node_modules\request\request.js:839:12)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)

thanks in advance.



via OiRc

No comments:

Post a Comment