1

我需要创建一个命令来搜索我的 google 自定义搜索以查找 google 网站。我已经有了自定义搜索 ID 和密钥。

我尝试使用一些 google npm 节点,但没有给我想要的结果,大多数都是用于图像查询。

这是来自谷歌

<html>
  <head>
    <title>JSON Custom Search API Example</title>
  </head>
  <body>
    <div id="content"></div>
    <script>
      function hndlr(response) {
      for (var i = 0; i < response.items.length; i++) {
        var item = response.items[i];
        // in production code, item.htmlTitle should have the HTML entities escaped.
        document.getElementById("content").innerHTML += "<br>" + item.htmlTitle;
      }
    }
    </script>
    <script src="https://www.googleapis.com/customsearch/v1?key=YOUR-KEY&cx=017576662512468239146:omuauf_lfve&q=cars&callback=hndlr">
    </script>
  </body>
</html>

就像我说的,我想将它用于 d.js 的自定义搜索命令......只是不太了解它。虽然我还是新手,但我已经编写了自己的机器人,所以我对它并不是很陌生,这部分让我很困惑。

4

0 回答 0