Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get Yahoo Weather Backgrounds from API?

I have a weather widget, and I need dynamic backgrounds. Yahoo has weather APIs, but I'm not able to find the background image tied to a weather type. https://weather.yahoo.com/ Is this possible?

var url = 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20location%3D%2248907%22&format=json'
            $.getJSON(url, function (data) {
                console.log(data)
            })
like image 736
triplethreat77 Avatar asked Jan 01 '26 01:01

triplethreat77


2 Answers

The API doesn't provide any images, but you can use a lot of the data to provide an image yourselves. Use for example the following properties

condition":{"code":"34", ...  // here you can bind an image to the code

Then you have a wind object

wind":{
  "chill":"55",       // thermometer?
  "direction":"0",     // use an image or a canvas to draw an arrow dynamically
  "speed":"0"
}, ...

and an atmosphere object

"atmosphere":{
  "humidity":"51",     // some drops?
  "pressure":"30.4",   // textual..
  "rising":"2",
  "visibility":"10"    // textual..
}, ...

And so on. As you can see there are many ways to illustrate these data but it's entirely up to you how to do it.

like image 70
torox Avatar answered Jan 03 '26 15:01

torox


Sorry but there is no API for this. But you can access their backgrounds by viewing the network activity on your browser developer tools.

The best solution is to build your own Api with your own images,

This is a sample of there background url:

https://s.yimg.com/os/mit/media/m/weather/images/fallbacks/lead/clear_n-e618500.jpg

like image 45
LeRoy Avatar answered Jan 03 '26 15:01

LeRoy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!