【问题标题】:How to return a Google Image Search based on condition如何根据条件返回 Google 图片搜索
【发布时间】:2018-04-24 18:30:53
【问题描述】:

我想制作一个网络应用,根据他们选择的位置的天气生成一套服装。

这是我目前所拥有的:https://codepen.io/anchpags/pen/bMpjxX

 <html>
  <head>

<link rel="stylesheet" href="http://toolness.github.io/weather-outfit-fun/weather-outfit.css">
<script src="http://toolness.github.io/weather-outfit-fun/weather-outfit.js"></script>

    <script>
function getForecastOutfit(forecast) {
  if (forecast.temp.f > 0) {
    return "http://some/picture";
  }
  return "http://toolness.github.io/weather-outfit-fun/img/eskimo-lomen-1915.jpg";
}

    </script>

    <title>What Should I Wear Today?</title>
  </head>
  <body>
    <h1>What Should I Wear Today?</h1>

  </body>
</html>

谁能帮助我了解如何使用自定义搜索 API 根据天气返回图像?

即如果是

我对编码很陌生,所以一个好的解释会很有帮助!

【问题讨论】:

    标签: javascript html css api google-custom-search


    【解决方案1】:

    有很多查询参数。您可以使用这些参数对其进行过滤。 https://developers.google.com/custom-search/json-api/v1/reference/cse/list

    【讨论】:

      【解决方案2】:

      我在这里做了一个关于如何使用谷歌搜索 API 的快速示例 https://github.com/MomoPlay/Google-Custom-Search-exemple 它搜索图像并显示它们。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-04-26
        • 1970-01-01
        • 2014-04-16
        • 2023-03-24
        相关资源
        最近更新 更多