1

WebClient.Downloadstring(MYURL)我有用于获取 Google 页面的ac#网络服务。

MYURL 等于:

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

它工作正常,直到我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 控制台说我没有进行任何搜索,所以我知道我没有超过我的配额。

这是怎么回事?

4

2 回答 2

1

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

于 2012-10-26T12:39:04.103 回答
0

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

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

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

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

文档有更多信息

于 2012-10-26T12:38:00.610 回答