I am attempting to recreate the NOAA forecast graph as a skin, and the first of many hurdles I foresee is capturing all the numbers so I can display them eventually. I found that NOAA has an XML version of the page, which is marginally easier to parse.
I started with temperature, because it seemed the easiest to parse.
Code: Select all
[MeasureGrabSite]
Measure=WebParser
URL=#XMLWeatherPage#
RegExp=(?s)(<data>.+<\/data>)
UpdateRate=30
;==================Grabs everything inside the "data" tags into StringIndex 1
;----------------------------------------------------------
[MeasureFuzzyLocation]
Measure=WebParser
URL=[MeasureGrabSite]
RegExp=(?s)<area-description>(.+)<\/area-description>
StringIndex=1
StringIndex2=1
;==================Pulls the Area Description from StringIndex 1 of the Master Grab
;----------------------------------------------------------
[MeasureTemp]
Measure=WebParser
URL=[MeasureGrabSite]
RegExp=(?s)<temperature type="hourly" time-layout="k-p1h-n1-0">(<value>\d{1,3}<\/value>.+)<\/temperature>
StringIndex=1
StringIndex2=1
;==================Pulls the temp data (plus the <value> tags) from StringIndex 1 of the Master Grab
[MeasureTempDigits]
Measure=WebParser
URL=[MeasureTemp]
RegExp=(?s)(\d{1,3})
StringIndex=1
StringIndex2=1
;==================Secondary regex to strip the <value> tags off the temp
I have other issues, like that it takes a full minute and 9 seconds for the skin to display the data that I have managed to get into a meter.
I have been using the RainRegExp tool quite a bit, as well as Regex101.com. There a whole slew of issues I can see ahead of me, so if any of you sages know of an easier way to do this, I'm all ears. There's no way to just render a snippet of html, is there?
Thanks,
Acercanto