Click here to Skip to main content
13,254,187 members (61,018 online)
Click here to Skip to main content
Add your own
alternative version


49 bookmarked
Posted 25 Apr 2007

Weather Forecast with Yahoo! Weather RSS Feed

Rate this:
Please Sign up or sign in to vote.
A class based on the Yahoo! Weather RSS feed.

Screenshot - Weather_forecast.jpg


Every time I wanted to use a weather forecast for my site, I found it too confusing. Each method I found had problems - some of the weather forecast Web services did not work properly. Eventually I noticed that Yahoo! has an RSS for its weather forecast. I decided to make a program to use that in my site and I created a class for it! I hope it will be useful for others who want to have weather forecasts in their programs.

Yahoo! Weather RSS feed

The Yahoo! 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 aggregate. You can also incorporate the RSS data into your own Web site or client application. The Yahoo! Weather RSS feed is a dynamically-generated feed that is based on zip code or Location ID.

RSS Request

The Yahoo! 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 (&). There are two parameters for Weather RSS:

  • p for location
  • u for degrees units (Fahrenheit or Celsius)

RSS Response

The Yahoo! Weather RSS feed is an XML document that conforms to RSS 2.0 specifications. 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. You can find all information about these elements on the Yahoo Developer page here. As it is represented in an XML document, we can convert it to classes by XML Serialization in .NET.

Understanding XML Serialization in the .NET Framework

XML Serialization enables you to convert common language runtime objects into XML documents or streams, and vise versa. XML Serialization makes it possible to convert XML documents into such a meaningful format that all programming languages can process the converted documents without any difficulty. You don't need to know much about XML Serialization to use this code, but it can help you to change or customize it yourself.

Using the Code

Using this code is as simple as making an instance of it and then sending its required parameters (Yahoo! Weather RSS parameters) to its constructor. The first parameter is US zip code or Location ID. The second one is Units for temperature. Send "f" for Fahrenheit or "c" for Celsius and then you can use it! Like this:

'//For example we send "IRXX0018" for Location ID of Tehran, and we want 
'//Units for temperature as Fahrenheit
 Dim t As New YahooWeatherForecast("IRXX0018", "f")


  • 25th April, 2007: Initial post
  • 15th May, 2007 - Updated source file
  • 3rd May, 2008: Updated source file


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Farhad Siasar Djahantighi 2
Iran (Islamic Republic of) Iran (Islamic Republic of)
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionWhy cannot I download the code? Pin
tdyso_zmh3-May-12 20:32
membertdyso_zmh3-May-12 20:32 
GeneralMy vote of 5 Pin
mahnazfekri26-Jul-11 1:19
membermahnazfekri26-Jul-11 1:19 
QuestionAdding Severe Weather Watch or Warnings or Both to your Library? Pin
timnboys25-Jun-10 11:09
membertimnboys25-Jun-10 11:09 
How to I Add Severe Weathers Watch or Warnings or Both to your Library
GeneralMy vote of 1 Pin
Dave Kreskowiak16-Jul-09 9:59
mvpDave Kreskowiak16-Jul-09 9:59 
QuestionAdding the Dew Point to your library? Pin
rspercy6014-Jul-09 16:32
memberrspercy6014-Jul-09 16:32 
AnswerRe: Adding the Dew Point to your library? Pin
Farhad Siasar Djahantighi14-Jul-09 19:12
memberFarhad Siasar Djahantighi14-Jul-09 19:12 
QuestionHeat Index? Pin
rspercy609-Jul-09 16:46
memberrspercy609-Jul-09 16:46 
AnswerRe: Heat Index?.....Answer Pin
rspercy6010-Jul-09 12:17
memberrspercy6010-Jul-09 12:17 
QuestionHow to get started Pin
mark lonsbury4-Apr-09 6:04
membermark lonsbury4-Apr-09 6:04 
AnswerRe: How to get started Pin
Farhad Siasar Djahantighi10-Jul-09 19:57
memberFarhad Siasar Djahantighi10-Jul-09 19:57 
QuestionI got a Ctype Error in VWD 2008 Express. What's wrong with the CType? Pin
cslamsg23-Oct-08 23:52
membercslamsg23-Oct-08 23:52 
Generalget tomorrows weather Pin
bflosabre9111-Aug-08 10:55
memberbflosabre9111-Aug-08 10:55 
GeneralYahoo! Weather mashup Pin
virtuPIC12-May-08 21:21
membervirtuPIC12-May-08 21:21 
General"Error in XML Document" Pin
sayeo872-May-08 6:07
membersayeo872-May-08 6:07 
GeneralRe: "Error in XML Document" Pin
Dan Suthar2-May-08 23:56
memberDan Suthar2-May-08 23:56 
GeneralRe: "Error in XML Document" Pin
arashk12-May-08 23:58
memberarashk12-May-08 23:58 
GeneralRe: "Error in XML Document" Pin
MCofer11-May-08 9:30
memberMCofer11-May-08 9:30 
GeneralRe: "Error in XML Document" Pin
MCofer11-May-08 11:20
memberMCofer11-May-08 11:20 
GeneralRe: "Error in XML Document" ...the fix Pin
rspercy609-Jul-09 12:52
memberrspercy609-Jul-09 12:52 
GeneralInput string was not in a correct format Pin
suresh00820-Mar-08 19:33
membersuresh00820-Mar-08 19:33 
GeneralRe: Input string was not in a correct format Pin
arashk123-Mar-08 22:45
memberarashk123-Mar-08 22:45 
GeneralMulti Day Forecast Pin
buster9526-Feb-08 17:52
memberbuster9526-Feb-08 17:52 
AnswerRe: Multi Day Forecast Pin
franzil8-May-08 3:19
memberfranzil8-May-08 3:19 
GeneralYahoo URL has changed to Pin
michael knopf14-Feb-08 5:12
membermichael knopf14-Feb-08 5:12 
GeneralVB Express 2005 Pin
Steve_5523-Oct-07 8:21
memberSteve_5523-Oct-07 8:21 
QuestionHow to change the language to Chinese ? Pin
tpang1328-Aug-07 1:37
membertpang1328-Aug-07 1:37 
GeneralAstronomy Class Pin
kfwbird26-Jul-07 14:45
memberkfwbird26-Jul-07 14:45 
AnswerRe: Astronomy Class Pin
arashk127-Jul-07 10:30
memberarashk127-Jul-07 10:30 
GeneralRe: Astronomy Class Pin
kfwbird30-Jul-07 11:57
memberkfwbird30-Jul-07 11:57 
QuestionPictures Pin
osilala2-Jul-07 7:46
memberosilala2-Jul-07 7:46 
AnswerRe: Pictures Pin
rspercy6010-Jul-09 14:13
memberrspercy6010-Jul-09 14:13 
AnswerRe: Pictures Pin
Farhad Siasar Djahantighi10-Jul-09 19:53
memberFarhad Siasar Djahantighi10-Jul-09 19:53 
GeneralUnable to connect to the remote server Pin
Cuu22-May-07 14:26
memberCuu22-May-07 14:26 
GeneralRe: Unable to connect to the remote server Pin
arashk122-May-07 19:55
memberarashk122-May-07 19:55 
GeneralRe: Unable to connect to the remote server Pin
Cuu23-May-07 6:06
memberCuu23-May-07 6:06 
GeneralRe: Unable to connect to the remote server Pin
Jap Santi29-May-07 19:07
memberJap Santi29-May-07 19:07 
Question2 forecast in RSS but only one in the lib? Pin
ducgerman20-May-07 23:58
memberducgerman20-May-07 23:58 
Question?? Pin
Steve Noll9-May-07 3:53
memberSteve Noll9-May-07 3:53 
AnswerRe: ?? [modified] Pin
arashk19-May-07 3:55
memberarashk19-May-07 3:55 
GeneralRe: ?? Pin
Steve Noll9-May-07 4:36
memberSteve Noll9-May-07 4:36 
GeneralRe: ?? Pin
arashk111-May-07 21:22
memberarashk111-May-07 21:22 
GeneralRe: ?? Pin
Steve Noll14-May-07 0:54
memberSteve Noll14-May-07 0:54 
GeneralRe: ?? Pin
arashk114-May-07 19:46
memberarashk114-May-07 19:46 
GeneralRe: ?? Pin
Steve Noll15-May-07 1:14
memberSteve Noll15-May-07 1:14 
GeneralWhats Wrong Pin
Steve Noll9-May-07 1:08
memberSteve Noll9-May-07 1:08 
GeneralRe: Whats Wrong Pin
arashk19-May-07 1:40
memberarashk19-May-07 1:40 
GeneralFacing Some Problem Pin
Rehan Hussain1-May-07 21:10
memberRehan Hussain1-May-07 21:10 
GeneralRe: Facing Some Problem Pin
arashk15-May-07 22:27
memberarashk15-May-07 22:27 
GeneralVery usefull Pin
TOL-WEBMASTER1-May-07 12:19
memberTOL-WEBMASTER1-May-07 12:19 
GeneralRe: Very usefull Pin
arashk11-May-07 20:23
memberarashk11-May-07 20:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171114.1 | Last Updated 13 Jul 2009
Article Copyright 2007 by Farhad Siasar Djahantighi 2
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid