如何使用javascript从谷歌搜索获取所有网址

时间:2015-12-05 11:31:13

标签: api url

我想通过谷歌搜索将所有网址添加到数组或txt中。这是我的代码,它允许我使用谷歌搜索API进行搜索。

  var ss = document.getElementById("searchBox").value;
  var searchControl = new google.search.SearchControl();
  // Add in a full set of searchers
  /*var localSearch = new google.search.LocalSearch();
  searchControl.addSearcher(localSearch);*/
  searchControl.addSearcher(new google.search.WebSearch());
    // create a drawOptions object
  var drawOptions = new google.search.DrawOptions();
  // tell the searcher to draw itself and tell it where to attach
  searchControl.draw(document.getElementById("searchcontrol"), drawOptions);
  // execute an inital search
  searchControl.execute(ss);
}

0 个答案:

没有答案