Is the a way to search in a country specific Google site using the search API?

我只是一个虾纸丫 提交于 2019-12-11 02:22:57

问题


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



来源:https://stackoverflow.com/questions/10320781/is-the-a-way-to-search-in-a-country-specific-google-site-using-the-search-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!