gpt4 book ai didi

search - 输入文本时获取 Google 搜索建议

转载 作者:行者123 更新时间:2023-12-03 06:36:53 26 4
gpt4 key购买 nike

所以我想尝试使用 Google 的搜索建议功能来完成单词/短语。IE。对于初学者来说,将在主页上输入搜索内容的功能粘贴到文本编辑器中。

是否可以使用其 REST API 请求这些 Google 搜索建议?或者以某种方式?

最佳答案

您可以使用以下网址之一从 Google 获取搜索建议:

<强>1。主页上建议框使用的URL

http://www.google.com/complete/search?hl=en&js=true&qu=sugge

查询部分是qu参数。响应示例如下:

window.google.ac.h(["sugge",[["suggest","200,000,000 results","0"],["suggestion box","27,500,000 results","1"],["suggestion","84,300,000 results","2"],["suggest friends on facebook","73,100,000 results","3"],["suggested calorie intake","1,940,000 results","4"],["suggestive","12,400,000 results","5"],["suggestion boxes","997,000 results","6"],["suggested weight for height and age","72,600,000 results","7"],["suggest synonym","2,490,000 results","8"],["suggestopedia","79,300 results","9"]]])

<强>2。 Google 工具栏使用的网址

http://toolbarqueries.google.com/complete/search?q=sugge&output=toolbar&hl=en

查询显然是q参数。这样做的优点是返回 XML 数据,在解析结果方面更容易、更可移植:

<?xml version="1.0"?>
<toplevel>
<CompleteSuggestion><suggestion data="suggest"/><num_queries int="200000000"/></CompleteSuggestion>
<CompleteSuggestion><suggestion data="suggestion box"/><num_queries int="27500000"/></CompleteSuggestion>
<CompleteSuggestion><suggestion data="suggestion"/><num_queries int="84300000"/></CompleteSuggestion>
<CompleteSuggestion><suggestion data="suggest friends on facebook"/><num_queries int="73100000"/></CompleteSuggestion>
<CompleteSuggestion><suggestion data="suggested calorie intake"/><num_queries int="1940000"/></CompleteSuggestion>
<CompleteSuggestion><suggestion data="suggestive"/><num_queries int="12400000"/></CompleteSuggestion>
<CompleteSuggestion><suggestion data="suggestion boxes"/><num_queries int="997000"/></CompleteSuggestion>
<CompleteSuggestion><suggestion data="suggested weight for height and age"/><num_queries int="72600000"/></CompleteSuggestion>
<CompleteSuggestion><suggestion data="suggest synonym"/><num_queries int="2490000"/></CompleteSuggestion>
<CompleteSuggestion><suggestion data="suggestopedia"/><num_queries int="79300"/></CompleteSuggestion>
</toplevel>

关于search - 输入文本时获取 Google 搜索建议,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3178777/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com