我想制作一个网络应用程序,根据他们选择的位置的天气生成一套衣服。
这是我目前拥有的: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 来根据天气返回图像吗?
即如果是 < 40 度的网站,则显示“保暖装”搜索的图像结果页面。
我对编码很陌生,所以一个好的解释会很有帮助!
最佳答案
查询参数很多。您可以使用这些参数对其进行过滤。 https://developers.google.com/custom-search/json-api/v1/reference/cse/list
关于javascript - 如何根据条件返回 Google 图片搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50008602/