Google Site Search无法返回结果

时间:2013-11-27 06:02:24

标签: google-search google-sites google-search-api

此代码大约2个月前正在运行。我知道它已被弃用,但几个月前它像10月初(2013年)一样正常运行。谷歌又改变了他们的API吗?

google.load('search', '1');

function OnLoad() {
  // Create a search control
  var searchControl = new google.search.SearchControl();

  // Add in a WebSearch
  var webSearch = new google.search.WebSearch();

  // Restrict our search to pages from the Cartoon Newtowrk
  webSearch.setSiteRestriction('stmikes.utoronto.ca');

  // Add the searcher to the SearchControl
  searchControl.addSearcher(webSearch);

  // tell the searcher to draw itself and tell it where to attach
  searchControl.draw(document.getElementById("content"));

  // execute an inital search
  searchControl.execute('SMC');
}

google.setOnLoadCallback(OnLoad);

HTML

<div id="content">Loading...</div>

1 个答案:

答案 0 :(得分:0)

这是deprecated and rate-limited。您应该使用Google自定义搜索。