Is the a way to search in a country specific Googl

2019-07-16 11:23发布

问题:

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:

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