3
votes

I have a script that reads Google results using Google custom search API, I went through the docs and I managed to set the language and country to filter the results but the results are still different from the results I get from the website.

https://www.googleapis.com/customsearch/v1?key=KEY&cx=017576662512468239146:omuauf_lfve&q=gelato

http://www.google.it/#hl=en&output=search&q=gelato

Is there a way to get the same results from the API as if I were using the website?

1
When you use the website yourself, it will be taking your web history and personalisations into account, probably the contents of your emails too...The search API will not do this, probably to prevent some form of privacy violation (ironic considering it's Google...)KingCronus

1 Answers

1
votes

Custom Search API says that 'cr' parameters is for Country restrict(s).

'hl' parameter is used to show results text in a specific language (user interface language).

'gl' parameter should be used if you want results to match geolocation relevance.

'lr' parameter should be used, in conjunction with or instead of 'cr' parameter, to restrict results to a specfic language.

https://developers.google.com/custom-search/v1/cse/list