Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Current temperature
.+? will match

Copy      Help
str Src Message Message2 zipcode url
zipcode="08620" ;;enter your zipcode here
str Forecast
url.from("" zipcode "?lswe=" zipcode "&lwsa=WeatherLocalUndeclared&from=whatwhere")
;out url

IntGetFile url Src
;out Src
if findrx(Src "<B class=obsTextA>(.+?)</B>" 0 1 Forecast 1)>=0
,Message.from("Forecast: " Forecast)
,mes(Message "Current Temperature" "isa")
Thanks a ton Gint!
Looks like now uses java scripting to generate pages. Therefore this macro is permanently broken. Does anyone have a better/simpler site to strip current weather content?
Matt B
I use the mobile phone page to get my stuff now; it's real simple too.
A new blog on QM coding and automation.

The Macro Hook
Agreed Ken. Thanks for this.
Matt B
Have you ever considered using the XML RSS feed featured on most weather sites?

National Weather service information if extremely reliable because they have weather spotters locally that report in:

or go straight to the rss page:

Here is the link for Chicago:
As you can see you'll need to know your latitude and longitude and then tack "&FcstType=dwml" on the end.
Geocode? Try this: ... on=forward
That will allow you to be able to convert a zip code to latitude and longitude. Maybe Gintaras could come up with a way to use the javascript on that page to return the lat and lon variables you'll need to format the weather service website string. I don't know how to do it myself. Basically the java is using google maps to determine the coordinates. Maybe writing a bit of code with QM to use google would be the way to go.

I think from a data point of view the XML from national weather service will allow for a pretty reliable access to weather data.

Information about all sorts of weather conditions including warnings and watches can be obtained through the National Weather service website.

So once you get the XML data...parse it. They even provide the links to their images. From here you could have in a program local conditions, warnings, temps, and all the neat little graphics to go along with it right in a program you are writing.

Jimmy Vig.

Forum Jump:

Users browsing this thread: 1 Guest(s)