PatNeedham/google-it

How to use additional search parameters?

Opened this issue · 1 comments

Hello,

Is this possible to use additional search parameters, for example &tbs=qdr:d?

Hi @toponline , currently it is not possible to use additional search parameters, although I think that can change relatively easily. Right now there is a getDefaultRequestOptions function that returns an object with the fixed query string parameters of q, num, and start. It's feasible to allow for custom parameters that would be added here. For invoking google-it via a NodeJS program it would be straightforward enough to add a params option:

googleIt({
  query: 'the irrelevant elegant elephant'
  params: {
    tbs: 'qdr:d'
  }
}

And if invoking via the command line, that might be trickier. I'm not sure how to pass an object as a command line argument, but maybe we can require it to be a string in JSON format, so that JSON.parse can be attempted to convert it to an object.