谷歌自定义搜索API#

时间:2012-10-26 12:26:52

标签: c# web-services google-api

我有一个c#webservice使用WebClient.Downloadstring(MYURL)来获取Google页面。

MYURL等于:

  

http://www.google.co.uk/search?q=mystringtosearch&as_qdr=all&num=100&start=0

它工作正常,直到我因为机器人而导致Google出现503错误。然后我被送到这里:

  

https://developers.google.com/custom-search/v1/overview

得到一把钥匙。现在它说我需要做的就是添加&key参数。但是,当我将其作为MYURL时,我仍然得到503

  

http://www.google.co.uk/search?q=mystringtosearch&key=1234567890&as_qdr=all&num=100&start=0

Google API控制台说我没有进行任何搜索,所以我知道我没有超过我的配额。

发生了什么事?

2 个答案:

答案 0 :(得分:1)

您需要在网址中包含自定义搜索引擎ID ..正如文档所述,这就是cx参数的用途。

答案 1 :(得分:0)

您确定使用的是正确的网址吗? 你的我的网址不是customsearch api的网址吗?

如果您查看自定义搜索的文档,这是: https://developers.google.com/custom-search/v1/using_rest?hl=tr

yuo可以通过向其URI发送HTTP GET请求来检索特定搜索的结果。搜索的URI具有以下格式:

https://www.googleapis.com/customsearch/v1?parameters

documantation有更多信息

相关问题