Jim H.
Jim H.

Reputation: 305

Yahoo weather api, how to fetch condition icons by condition code?

I'm trying to find links to weather condition images for Yahoo weather api. I get condition codes in JSON response, guess images are based on them. Like for OpenWeatherMap you add condition code to main URL http://openweathermap.org/img/w/(conditionCode)

How to do that for yahoo images?

Upvotes: 4

Views: 1702

Answers (2)

TimW
TimW

Reputation: 156

Not sure why the question has been downvoted, I had a similar question and this helped, but the other answer didn't work for HTTPS.

For HTTPS: Night time image:

https://s.yimg.com/zz/combo?a/i/us/nws/weather/gr/28n.png

Day time image:

https://s.yimg.com/zz/combo?a/i/us/nws/weather/gr/28d.png

You will see that the last number (28 in this example) is the condition code from the Yahoo API Response plus a code to represent day 'd' or night 'n'.

I noticed the images are quite different, firstly they are PNG's but they are also larger and include transparency.

Jim H's answer is correct for HTTP.

Upvotes: 4

Jim H.
Jim H.

Reputation: 305

Link to the images is embedded in the api response down somewhere in description element. Add code number accordingly and download the image

http://l.yimg.com/a/i/us/we/52/(code_number).gif

Upvotes: 5

Related Questions