Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
查看 Google 自定义搜索 api
http://code.google.com/apis /customsearch/v1/overview.html
Have a look on google custom search api
http://code.google.com/apis/customsearch/v1/overview.html
在这种情况下,您通常会使用您希望使用或呈现给客户的服务的供应商提供的 API;但据我所知,谷歌没有提供用于搜索的 API,因为总的来说,搜索是谷歌所做的™。
当然,您可以将常规 HTTP 搜索提交到 http://google.com 并抓取生成的 HTML 以获取结果;但如果他们改变标记,该方法极有可能被破坏;并且您可能会面临被 Google 法律团队追究的风险。
使劲铰。
编辑:回复:API 我已更正;看来你实际上有一个选择:要么付出你的鼻子,要么冒着断裂和扩孔的风险。
What you would normally do in this situation is to employ an API provided by the vendor of the service you wish to consume or present to your customers; but AFAIK Google provides no API for searches, considering the fact that, by and large, searches is what Google Does™.
You could of course submit regular HTTP searches to http://google.com and scrape the resulting HTML for the results; but that method is extremely liable to breakage if they change their markup; and you risk getting reamed by Google's legal team.
Reamed hard.
Edit: Re: API I stand corrected; it appears you actually have a choice: Pay out your nose, or risk breakage and reaming.