The Weather RSS feed enables you to get up-to-date weather information for your location. You can save this feed in My Yahoo! or your favorite feed aggregator, or incorporate the RSS data into your own web site or client application. The Weather RSS feed is a dynamically-generated feed based on WOEID.
This page describes the format of the Weather request URL and the RSS response for developers. It contains these sections:
The Weather RSS feed request follows simple HTTP GET syntax: start with a base URL and then add parameters and values after a question mark (?). Multiple parameters are separated by an ampersand (&).
The base URL for the Weather RSS feed is
http://weather.yahooapis.com/forecastrss
In this section, Summary shows how to make an RSS request with different parameters; Request Parameters shows a table summarizing those parameters.
For the Weather RSS feed there are two parameters:
w
for WOEID.u
for degrees units (Fahrenheit or Celsius).The WOEID parameter w
is required. Use this parameter to indicate
the location for the weather forecast as a WOEID.
http://weather.yahooapis.com/forecastrss?w=
location
For example, to get weather for Yahoo! Headquarters in Sunnyvale, CA, use the WOEID code for Sunnyvale (2502265):
http://weather.yahooapis.com/forecastrss?w=2502265
The location parameter needs to be a WOEID. To find your
WOEID, browse or search for your city from the Weather home
page. The WOEID is in the URL for the forecast page for that city. You
can also get the WOEID by entering your zip code on the home page.
For example, if you search for Los Angeles on the Weather home
page, the forecast page for that city is http://weather.yahoo.com/united-states/california/los-angeles-2442047/
.
The WOEID is 2442047
.
The optional u (units) parameter indicates the degree units for the weather forecast. By default, Yahoo! Weather returns temperature information in degrees Fahrenheit. Use the u parameter to explicitly specify the degree units in Fahrenheit (f) or Celsius (c). The units parameter is case sensitive. For example, to get the weather forecast in Sunnyvale, CA in Celsius:
http://weather.yahooapis.com/forecastrss?w=2442047&u=c
Note that choosing Celsius degree units changes all the weather units to metric, for example, wind speed will be reported as kilometers per hour and barometric pressure as millibars.
Yahoo! Weather returns an RSS 2.0 feed in response to this request. You can subscribe to the request URL with My Yahoo! or another RSS feed aggregator, or you can incorporate the information in the RSS response into your own application. See RSS Response Elements for information on the elements contained in the RSS feed.
Parameter | Description | Example |
---|---|---|
w | WOEID | w=2502265 |
u | Units for temperature (case sensitive) f: Fahrenheit c: Celsius |
u=c |
Note: The old location parameter 'p' has been deprecated and will be removed in the future releases. Hence users are encouraged to migrate to the 'w' parameter which provides deep integration into Y! GeoPlanet. The old documentation is archived here.
The Weather RSS feed is an XML document that conforms to the RSS 2.0 specification. RSS is an XML document containing a single channel element representing the feed, several elements containing metadata about the feed itself, and one or more item elements describing individual items within the feed.
The Weather RSS feed also includes additional elements from the geo vocabulary as well as a custom yweather vocabulary.
Element | Description |
---|---|
xml | The Weather RSS feed conforms to XML 1.0. No child elements. |
rss | The Weather RSS feed conforms to RSS 2.0. Child elements: channel |
The channel element contains metadata about the feed and its contents.
Element | Description |
---|---|
title | The title of the feed, which includes the location city. For example "Yahoo! Weather - Sunnyvale, CA" |
link | The URL for the Weather page of the forecast for this
location. For example http://us.rd.yahoo.com/dailynews/rss/weather/ Sunnyvale__CA/ *http://weather.yahoo.com/ forecast/USCA1116_f.html |
language | The language of the weather forecast, for example, en-us for US English. |
description | The overall description of the feed including the location, for example "Yahoo! Weather for Sunnyvale, CA" |
lastBuildDate | The last time the feed was updated. The format is in the date format defined by RFC822 Section 5, for example Mon, 256 Sep 17:25:18 -0700. |
ttl | Time to Live; how long in minutes this feed should be cached. |
yweather:location | The location of this forecast. Attributes:
|
yweather:units | Units for various aspects of the forecast. Attributes:
|
yweather:wind | Forecast information about wind. Attributes:
|
yweather:atmosphere | Forecast information about current atmospheric pressure, humidity,
and visibility. Attributes:
|
yweather:astronomy | Forecast information about current astronomical conditions. Attributes:
|
image | The image used to identify this feed. See Image Elements for
element descriptions Child elements: url, title, link, width, height |
item | The local weather conditions and forecast for a specific location.
See Item Elements for element descriptions. Child elements: title, link, description, guid, pubDate, geo:lat, geo:long, yweather:forecast |
The image element describes an image or icon used to identify the feed.
Element | Description |
---|---|
title | The title of the image, for example "Yahoo! Weather" |
link | The URL of Yahoo! Weather |
url | The URL of the image |
width | The width of the image, in pixels |
height | The height of the image, in pixels |
The item element contains current conditions and forecast for the given location. There are multiple yweather:forecast elements for today and tomorrow.
Element | Description |
---|---|
title | The forecast title and time, for example "Conditions for New York, NY at 1:51 pm EST" |
link | The Yahoo! Weather URL for this forecast. |
description | A simple summary of the current conditions and tomorrow's forecast, in HTML format, including a link to Yahoo! Weather for the full forecast. |
guid | Unique identifier for the forecast, made up of the location ID, the date, and the time. The attribute isPermaLink is false. |
pubDate | The date and time this forecast was posted, in the date format defined by RFC822 Section 5, for example Mon, 25 Sep 17:25:18 -0700. |
geo:lat | The latitude of the location. |
geo:long | The longitude of the location. |
yweather:condition | The current weather conditions. Attributes:
|
yweather:forecast | The weather forecast for a specific day. The item element contains
multiple forecast elements for today and tomorrow. Attributes:
|
Condition codes are used in the yweather:forecast element to describe the current conditions.
Code | Description |
---|---|
0 | tornado |
1 | tropical storm |
2 | hurricane |
3 | severe thunderstorms |
4 | thunderstorms |
5 | mixed rain and snow |
6 | mixed rain and sleet |
7 | mixed snow and sleet |
8 | freezing drizzle |
9 | drizzle |
10 | freezing rain |
11 | showers |
12 | showers |
13 | snow flurries |
14 | light snow showers |
15 | blowing snow |
16 | snow |
17 | hail |
18 | sleet |
19 | dust |
20 | foggy |
21 | haze |
22 | smoky |
23 | blustery |
24 | windy |
25 | cold |
26 | cloudy |
27 | mostly cloudy (night) |
28 | mostly cloudy (day) |
29 | partly cloudy (night) |
30 | partly cloudy (day) |
31 | clear (night) |
32 | sunny |
33 | fair (night) |
34 | fair (day) |
35 | mixed rain and hail |
36 | hot |
37 | isolated thunderstorms |
38 | scattered thunderstorms |
39 | scattered thunderstorms |
40 | scattered showers |
41 | heavy snow |
42 | scattered snow showers |
43 | heavy snow |
44 | partly cloudy |
45 | thundershowers |
46 | snow showers |
47 | isolated thundershowers |
3200 | not available |
To get the forecast for Yahoo! Headquarters in Sunnyvale, CA, use the WOEID code:
http://weather.yahooapis.com/forecastrss?w=2502265
To get the forecast for New York City, use the WOEID 2459115:
http://weather.yahooapis.com/forecastrss?w=2459115
To get the forecast for Paris, France, use the WOEID 615702:
http://weather.yahooapis.com/forecastrss?w=615702
To get the forecast for Paris, France, with degrees Celsius and other metric units:
http://weather.yahooapis.com/forecastrss?w=615702&u=c
A sample RSS response is shown below:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> <channel> <title>Yahoo! Weather - Sunnyvale, CA</title> <link>http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/*http://weather.yahoo.com/forecast/USCA1116_f.html</link> <description>Yahoo! Weather for Sunnyvale, CA</description> <language>en-us</language> <lastBuildDate>Fri, 18 Dec 2009 9:38 am PST</lastBuildDate> <ttl>60</ttl> <yweather:location city="Sunnyvale" region="CA" country="United States"/> <yweather:units temperature="F" distance="mi" pressure="in" speed="mph"/> <yweather:wind chill="50" direction="0" speed="0" /> <yweather:atmosphere humidity="94" visibility="3" pressure="30.27" rising="1" /> <yweather:astronomy sunrise="7:17 am" sunset="4:52 pm"/> <image> <title>Yahoo! Weather</title> <width>142</width> <height>18</height> <link>http://weather.yahoo.com</link> <url>http://l.yimg.com/a/i/us/nws/th/main_142b.gif</url> </image> <item> <title>Conditions for Sunnyvale, CA at 9:38 am PST</title> <geo:lat>37.37</geo:lat> <geo:long>-122.04</geo:long> <link>http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/*http://weather.yahoo.com/forecast/USCA1116_f.html</link> <pubDate>Fri, 18 Dec 2009 9:38 am PST</pubDate> <yweather:condition text="Mostly Cloudy" code="28" temp="50" date="Fri, 18 Dec 2009 9:38 am PST" /> <description><![CDATA[ <img src="http://l.yimg.com/a/i/us/we/52/28.gif"/><br /> <b>Current Conditions:</b><br /> Mostly Cloudy, 50 F<BR /> <BR /><b>Forecast:</b><BR /> Fri - Partly Cloudy. High: 62 Low: 49<br /> Sat - Partly Cloudy. High: 65 Low: 49<br /> <br /> <a href="http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/*http://weather.yahoo.com/forecast/USCA1116_f.html">Full Forecast at Yahoo! Weather</a><BR/><BR/> (provided by <a href="http://www.weather.com" >The Weather Channel</a>)<br/> ]]></description> <yweather:forecast day="Fri" date="18 Dec 2009" low="49" high="62" text="Partly Cloudy" code="30" /> <yweather:forecast day="Sat" date="19 Dec 2009" low="49" high="65" text="Partly Cloudy" code="30" /> <guid isPermaLink="false">USCA1116_2009_12_18_9_38_PST</guid> </item> </channel> </rss>
The feeds are provided free of charge for use by individuals and non-profit organizations for personal, non-commercial uses. We ask that you provide attribution to Yahoo! Weather in connection with your use of the feeds.
If you provide this attribution in text, please use: "Yahoo! Weather." If you provide this attribution with a graphic, please use the Yahoo! Weather logo that we have included in the feed itself.
We reserve all rights in and to the Yahoo! Weather logo, and your right to use the Yahoo! Weather logo is limited to providing attribution in connection with these RSS feeds.
Yahoo! also reserves the right to require you to cease distributing these feeds at any time for any reason.