Google自定义搜索图片返回500错误

问题描述 投票:8回答:2

大约40小时前开始,用于图片搜索的Google自定义搜索(searchType = image)始终返回500错误。我已经仔细检查了API文档,似乎没有任何变化。正如你在这个论坛中看到的那样,这影响了很多人。

https://productforums.google.com/forum/#!category-topic/customsearch/troubleshooting-and-bugs/4bJPzGPLYfw

这是我回复的全部内容:

{
   "error": {
       "code": 500,
       "message": null
   }
}

我曾试图打电话给Google,但他们只是将我重定向到那些绝对没有相关信息的网站。

有没有人设法让这个工作或与谷歌的人交谈过?我们正在大量使用这个功能,并且长期使用这个功能非常昂贵。

web search-engine google-custom-search google-image-search
2个回答
1
投票

我们通过删除searchType = image并更改代码来遍历json来解决它。下面的代码更改传达了这个想法:

从:

$.each(response.items, function(index, item) {
      images.push(item.link);
  });

至:

  $.each(response.items, function(index, item) {
    if ((item.pagemap) && (item.pagemap.cse_image) && (item.pagemap.cse_image[0]) && (item.pagemap.cse_image[0].src)) {
      images.push(item.pagemap.cse_image[0].src);
    }
  });

希望有所帮助。

Ps:不酷,谷歌,不酷。

编辑:上面的解决方法可能不是你正在搜索的,因为图像的谷歌自定义搜索(CSE)再次工作(大约3天,重新开始+/- 12/12/2014)。


0
投票

解决方案很简单。您只需要进入control panel并确保“图像搜索”选项处于活动状态。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.