It is currently April 27th, 2024, 11:01 pm

Built weather skin

Get help with creating, editing & fixing problems with skins
User avatar
frankm1977
Posts: 74
Joined: March 11th, 2010, 6:21 pm

Built weather skin

Post by frankm1977 »

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
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Built weather skin

Post by jsmorley »

RSS feed html:

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&nbsp;&deg;C		, Humidité		74%		, Vents 

		15km/h		</description>

	

    </item>

				



    <item>

      <title>Mardi, 13 d&#233;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&nbsp;&deg;C, T. Min  -6&nbsp;&deg;C, P.D.P.  40%	  

	  </description>

    </item>



   <item>

      <title>Mercredi, 14 d&#233;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&nbsp;&deg;C, T. Min -8&nbsp;&deg;C, P.D.P. 20%	  

	  </description>

    </item>



     <item>

      <title>Jeudi, 15 d&#233;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&nbsp;&deg;C, T. Min -6&nbsp;&deg;C, P.D.P. 90%	  

	  </description>

    </item>

      </channel>

</rss>
RegExp:

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. (.*)\%"
StringIndex => Result:

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&#233;cembre, 2011
08=> Nuageux avec quelques flocons
09=> 1
10=> -6
11=> 40
12=> Mercredi, 14 d&#233;cembre, 2011
13=> Ensoleillé avec passages nuageux
14=> -2
15=> -8
16=> 20
17=> Jeudi, 15 d&#233;cembre, 2011
18=> Pluie et neige
19=> 5
20=> -6
21=> 90
You will want to use DecodeCharacterReference=1 on the measures returning the titles like "Mercredi, 14 d&#233;cembre, 2011", so those encoded characters are translated.
User avatar
frankm1977
Posts: 74
Joined: March 11th, 2010, 6:21 pm

Re: Built weather skin

Post by frankm1977 »

Thanks a lot i will try it in the next day... i let you know if everything work properly.
:D