如何从 Google 图片搜索中获得 JSON 响应?

How to get a JSON response from a Google Image Search?

我只想进行简单的 Google 图片 搜索。我们正在使用现在完全 deprecated JSON Image Search API.

的古老的、非常非常简单的方法

该页面现在表示它包含在 Google 自定义搜索 中。问题是我不想搜索自己的网站,我仍然想在网上搜索图片。在我的一生中,我无法找到执行此操作的新方法。

我试过Google API for PHP,它也只适用于自定义搜索,它只适用于在我的网站上搜索,而不适用于整个网络。

我已经用 https://www.googleapis.com/customsearch/v1?key=MYKEY&cx=MYCX&q=candy 试过了,它仍然只搜索我们的网站,而不是一般的网络。

谁能给我指点一个文档页面,该页面描述了如何使用 API 在网络上进行一般图像搜索并在 JSON 中获得结果?

您确实可以将 Google API 用于 PHP。您只需配置自定义搜索引擎即可搜索整个网络。为此,请在 https://cse.google.com/cse/ 登录您的 CSE 设置,然后删除所有网站。 然后,将 'Sites to search' 更改为 'Search the entire web but emphasize included sites'。 由于您没有指定任何网站,它只会搜索整个网络。

您可以使用右侧的框进行测试。

关于文档,CSE API 记录在此处 https://developers.google.com/custom-search/json-api/v1/reference/cse/list#parameters