用Bing自定义搜索替换GCSE

时间:2017-07-26 19:05:52

标签: bing google-custom-search

由于Google正在取消Google自定义搜索引擎,因此我转而使用Bing的类似服务。谷歌提供了这样一个脚本:

<script>
 (function() {
   var cx = 'KEY';
   var gcse = document.createElement('script');
   gcse.type = 'text/javascript';
   gcse.async = true;
   gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +'//cse.google.com/cse.js?cx=' + cx;var s = document.getElementsByTagName('script')[0];
   s.parentNode.insertBefore(gcse, s);
 })();
</script>

<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>

我可以用它来将结果显示为iframe。我喜欢这个,因为这意味着我没有必要处理显示,分页等.Bing提供类似的东西,还是我必须自己编写?

1 个答案:

答案 0 :(得分:0)

自定义搜索确实提供了托管的用户体验,作为其中的一部分,它提供了javascript代码段和html端点。它是customsearch.ai中实例创建的一部分。