当我执行使用谷歌AJAX API(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=flowers&gl=fr)得到真正的谷歌搜索结果中谷歌AJAX API
我搜索(与GL = FR) 第一个找到的网址是:flowercampings.com。
而当我使用google.fr,第一个环节是:www.1800flowers.com
我如何使用API(我需要的RESTinterface参数) 感谢您的帮助
当我执行使用谷歌AJAX API(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=flowers&gl=fr)得到真正的谷歌搜索结果中谷歌AJAX API
我搜索(与GL = FR) 第一个找到的网址是:flowercampings.com。
而当我使用google.fr,第一个环节是:www.1800flowers.com
我如何使用API(我需要的RESTinterface参数) 感谢您的帮助
你不能。
没有“真实”结果。
您看到的SERP(搜索引擎结果页面)!=一个其他人看到的SERP,因为一些因素被考虑在内(位置,您的网络历史记录,前期搜索,登录,注销,一天中的时间,...)
是的,API已知不会显示与谷歌搜索页面相同的结果(有人说这是一个较旧的谷歌索引,我认为它只是不同),但如果下一个人再次从你的电脑搜索到他,他可能还会看到另一个SERP。
获得相同结果的唯一方法就是在计算机上安装可编程浏览器,然后取消结果并自行创建JSON。但这可能不是你想要的。
几乎搜索引擎基于您的个人信息(位置,国家,语言,历史,搜索行为/趋势,...)来计算结果页面,这是理由。
我们已经建立了运行一个完整的浏览器取回结果是尽可能接近实际的东西看用户的解决方案:https://serpapi.com
我们有几种语言integreations。的Python:
from lib.google_search_results import GoogleSearchResults
query = GoogleSearchResults({"q": "coffee"})
html_results = query.get_html()
GitHub的:https://github.com/serpapi/google_search_results_python
的Java:
Map<String, String> parameter = new HashMap<>();
parameter.put("q", "Coffee");
parameter.put("location", "Portland");
parameter.put(GoogleSearchResults.SERP_API_KEY_NAME, "demo");
GoogleSearchResults serp = new GoogleSearchResults(parameter);
JsonObject data = serp.getJson();
JsonArray results = (JsonArray) data.get("local_results");
JsonObject first_result = results.get(0).getAsJsonObject();
System.out.println("first coffee: " + first_result.get("title").getAsString());
GitHub上:https://github.com/serpapi/google_search_results_java
和Ruby:
require 'google_search_results'
query = GoogleSearchResults.new q: "coffee"
hash_results = query.get_hash
GitHub上: https://github.com/serpapi/google-search-results-ruby