node-google icon indicating copy to clipboard operation
node-google copied to clipboard

How can i skip some results?

Open Nisthar opened this issue 8 years ago • 1 comments

I want to skip some results that i already visited. How can i skip some results based on a condition in my code?

Nisthar avatar Aug 04 '17 18:08 Nisthar

If you need to offset the results that are returned, then just pass the optional "start" parameter into the google function. This will return from the 3rd page of results:

google ('test query', 20, ( err, res ) => {
  if (err) console.error(err)

  for (var i = 0; i < res.links.length; ++i) {
    var link = res.links[i];
    console.log(link.title + ' - ' + link.href)
    console.log(link.description + "\n")
  }

  if (nextCounter < 4) {
    nextCounter += 1
    if (res.next) res.next()
  }
})

tpickett avatar Oct 28 '17 00:10 tpickett