Here is the complete regular expression for parsing data from yahoo weather rss feed:
Code: Select all
(?siU)<title>.*city="(.*)".*"(.*)".*"(.*)".*temperature="(.*)".*"(.*)".*"(.*)".*"(.*)".*chill="(.*)".*"(.*)".*"(.*)".*humidity="(.*)".*"(.*)".*"(.*)".*"(.*)".*sunrise="(.*):(.*)\s(.*)".*"(.*):(.*)\s(.*)".*<geo:lat>(.*)</geo:lat>.*<geo:long>(.*)</geo:long>.*<yweather:condition text="(.*)".*"(.*)".*"(.*)".*"(.*),\s(.*)\s(.*)\s(.*)\s(.*):(.*)\s(.*)\s(.*)".*<yweather:forecast day="(.*)".*"(.*)\s(.*)\s(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*<yweather:forecast day="(.*)".*"(.*)\s(.*)\s(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*<yweather:forecast day="(.*)".*"(.*)\s(.*)\s(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*<yweather:forecast day="(.*)".*"(.*)\s(.*)\s(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*<yweather:forecast day="(.*)".*"(.*)\s(.*)\s(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*
Code: Select all
<yweather:forecast day="(.*)".*"(.*)\s(.*)\s(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*
- 1 - City
2 - Region
3 - Country
4 - Temperature Unit (c: Celsius, f: Farheneit)
5 - Distance unit (mi: Miles, km: Kilometers)
6 - Barometric pressure unit (in: pounds on square inches, mb: millibar)
7 - Speed unit (mph: miles per hour, km/h: kilometers per hour)
8 - Wind: temperature (in specified unit)
9 - Wind: direzione (in sessagesimal degrees)
10 - Wind: speed (in specified unit)
11 - Atmosphere: humidity (percentual value)
12 - Atmosphere: visibility (in specified unit)
13 - Atmosphere: barometric pressure (in specified unit)
14 - Atmosphere: behavior of the barometric pressure (0: constant, 1: increasing, 2: decreasing)
15 - Astronomy: sunrise time (hours: integer value from 1 to 12)
16 - Astronomy: sunrise time (minutes: integer value from 00 to 59)
17 - Astronomy: sunrise time (am: morning, pm: noon)
18 - Astronomy: sunset time (hours: integer value from 1 to 12)
19 - Astronomy: sunset time (minutes: integer value from 00 to 59)
20 - Astronomy: sunset time (am: morning, pm: noon)
21 - Localization: latitude
22 - Localization: longitude
23 - Weather: description (text string)
24 - Weather: description code (integer value)
25 - Weather: temperature (in specified unit)
26 - Weather: weather condition date and time (first three letters of the day in english)
27 - Weather: weather condition date and time (number for the day of the month from 1 to 31)
28 - Weather: weather condition date and time (name of the month in english)
29 - Weather: weather condition date and time (year)
30 - Weather: weather condition date and time (hours: integer value from 1 to 12)
31 - Weather: weather condition date and time (minutes: integer value from 00 to 59)
32 - Weather: weather condition date and time (am: morning, pm: noon)
33 - Weather: weather condition date and time (time format)
34 - Current day forecasts: first three letters of the day in english
35 - Current day forecasts: number for the day of the month from 1 to 31
36 - Current day forecasts: name of the month in english
37 - Current day forecasts: year
38 - Current day forecasts: minimum estimated temperature (in specified unit)
39 - Current day forecasts: maximum estimated temperature (in specified unit)
40 - Current day forecasts: description (text string)
41 - Current day forecasts: description code (integer value)
42 - First successive day forecasts: first three letters of the day in english
43 - First successive day forecasts: number for the day of the month from 1 to 31
44 - First successive day forecasts: name of the month in english
45 - First successive day forecasts: year
46 - First successive day forecasts: minimum estimated temperature (in specified unit)
47 - First successive day forecasts: maximum estimated temperature (in specified unit)
48 - First successive day forecasts: description (text string)
49 - First successive day forecasts: description code (integer value)
50 - Second successive day forecasts: first three letters of the day in english
51 - Second successive day forecasts: number for the day of the month from 1 to 31
52 - Second successive day forecasts: name of the month in english
53 - Second successive day forecasts: year
54 - Second successive day forecasts: minimum estimated temperature (in specified unit)
55 - Second successive day forecasts: maximum estimated temperature (in specified unit)
56 - Second successive day forecasts: description (text string)
57 - Second successive day forecasts: description code (integer value)
58 - Third successive day forecasts: first three letters of the day in english
59 - Third successive day forecasts: number for the day of the month from 1 to 31
60 - Third successive day forecasts: name of the month in english
61 - Third successive day forecasts: year
62 - Third successive day forecasts: minimum estimated temperature (in specified unit)
63 - Third successive day forecasts: maximum estimated temperature (in specified unit)
64 - Third successive day forecasts: description (text string)
65 - Third successive day forecasts: description code (integer value)
66 - Fourth successive day forecasts: first three letters of the day in english
67 - Fourth successive day forecasts: number for the day of the month from 1 to 31
68 - Fourth successive day forecasts: name of the month in english
69 - Fourth successive day forecasts: year
70 - Fourth successive day forecasts: minimum estimated temperature (in specified unit)
71 - Fourth successive day forecasts: maximum estimated temperature (in specified unit)
72 - Fourth successive day forecasts: description (text string)
73 - Fourth successive day forecasts: description code (integer value)
Code: Select all
http://weather.yahooapis.com/forecastrss?w=YOURWOEID&u=YOURTEMPUNIT
Those 6 digits are exactly the WOEID (Where on Earth Identifier) you are searching for.
You can alternatively search your WOEID on this website: http://woeid.rosselliot.co.nz/lookup
Substitute YOURWOEID within the url in this document with the WOEID you have found on the internet.
Substitute YOURTEMPUNIT with f or c if you want Farenheit temperature unit or Celsius temperature unit.
If you choose Farenheit all other measure units will be miles for distance, pounds on square inches for barometric pressure, miles per hour for speed.
If you choose Celsius all other measure units will be kilometers for distance, millibar for barometric pressure, kilometers per hour for speed.
Example
London WOEID: 44418
Unit: c
Code: Select all
http://weather.yahooapis.com/forecastrss?w=44418&u=c