I want to built a weather skin based on this site
http://rss.meteomedia.com/weather/caqc0441
But with the regexp im a littel bit lost
Thanks
It is currently April 27th, 2024, 11:01 pm
Built weather skin
-
- Posts: 74
- Joined: March 11th, 2010, 6:21 pm
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Built weather skin
RSS feed html:
RegExp:
StringIndex => Result:
You will want to use DecodeCharacterReference=1 on the measures returning the titles like "Mercredi, 14 décembre, 2011", so those encoded characters are translated.
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?><rss version="2.0">
<channel>
<title>MétéoMédia - Québec, Québec</title>
<link>http://www.meteomedia.com/index.php?product=weather&placecode=caqc0441&ref=current_obs</link>
<description>MétéoMédia - Des cartes météo des bulletins saisonniers des prévisions pour le Canada les États-Unis et ailleurs au monde météo personnalisées. </description>
<copyright>Copyright MétéoMédia</copyright>
<language>en-us</language>
<image>
<url>http://www.meteomedia.com/common/images/rss/rss_logo_fr.jpg</url>
<title>MétéoMédia</title>
<link>http://www.meteomedia.com/index.php?product=weather&placecode=caqc0441&ref=current_obs</link>
</image>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<item>
<title>Conditions actuelles</title>
<guid>http://www.meteomedia.com/index.php?product=weather&placecode=caqc0441&ref=current_obs</guid>
<link>http://www.meteomedia.com/index.php?product=weather&placecode=caqc0441&ref=current_obs</link>
<pubDate>Sun, 11 Dec 2011, 10:00:00 HNE</pubDate>
<image>
<url>http://rss.counter.weather.ca/counter.gif</url>
<title>spacer</title>
<link>http://www.meteomedia.com/index.php?product=weather&placecode=caqc0441&ref=current_obs</link>
</image>
<description>Nuageux,
-2 °C , Humidité 74% , Vents
15km/h </description>
</item>
<item>
<title>Mardi, 13 décembre, 2011</title>
<guid>http://www.meteomedia.com/index.php?product=weather&placecode=caqc0441&ref=day1#ltermfx</guid>
<link>http://www.meteomedia.com/index.php?product=weather&placecode=caqc0441&ref=day1#ltermfx</link>
<pubDate>Sun, 11 December, 2011, 03:50:00 HNE</pubDate>
<description>
Nuageux avec quelques flocons,
T. Max 1 °C, T. Min -6 °C, P.D.P. 40%
</description>
</item>
<item>
<title>Mercredi, 14 décembre, 2011</title>
<link>http://www.meteomedia.com/index.php?product=weather&placecode=caqc0441&ref=day2#ltermfx</link>
<guid>http://www.meteomedia.com/index.php?product=weather&placecode=caqc0441&ref=day2#ltermfx</guid>
<pubDate>Sun, 11 December, 2011, 03:50:00 HNE</pubDate>
<description>
Ensoleillé avec passages nuageux,
T. Max -2 °C, T. Min -8 °C, P.D.P. 20%
</description>
</item>
<item>
<title>Jeudi, 15 décembre, 2011</title>
<link>http://www.meteomedia.com/index.php?product=weather&placecode=caqc0441&ref=day3#ltermfx</link>
<guid>http://www.meteomedia.com/index.php?product=weather&placecode=caqc0441&ref=day3#ltermfx</guid>
<pubDate>Sun, 11 December, 2011, 03:50:00 HNE</pubDate>
<description>
Pluie et neige,
T. Max 5 °C, T. Min -6 °C, P.D.P. 90%
</description>
</item>
</channel>
</rss>
Code: Select all
RegExp="(?siU)<title>.*\- (.*)</title>.*<link>(.*)</link>.*<title>Conditions actuelles</title>.*<description>(.*),(?-U)\s+(?U)(.*)&.*Humidité(?-U)\s+(?U)(.*)\%.*, Vents(?-U)\s+(?U)(.*)k.*<item>.*<title>(.*)</title>.*<description>(?-U)\s+(?U)(.*),.*Max (.*)&.*Min (.*)&.*D.P. (.*)\%.*<item>.*<title>(.*)</title>.*<description>(?-U)\s+(?U)(.*),.*Max (.*)&.*Min (.*)&.*D.P. (.*)\%.*<item>.*<title>(.*)</title>.*<description>(?-U)\s+(?U)(.*),.*Max (.*)&.*Min (.*)&.*D.P. (.*)\%"
Code: Select all
01=> Québec, Québec
02=> http://www.meteomedia.com/index.php?product=weather&placecode=caqc0441&ref=current_obs
03=> Nuageux
04=> -2
05=> 74
06=> 15
07=> Mardi, 13 décembre, 2011
08=> Nuageux avec quelques flocons
09=> 1
10=> -6
11=> 40
12=> Mercredi, 14 décembre, 2011
13=> Ensoleillé avec passages nuageux
14=> -2
15=> -8
16=> 20
17=> Jeudi, 15 décembre, 2011
18=> Pluie et neige
19=> 5
20=> -6
21=> 90
-
- Posts: 74
- Joined: March 11th, 2010, 6:21 pm
Re: Built weather skin
Thanks a lot i will try it in the next day... i let you know if everything work properly.