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

Macro
Code:
Copy      Help
;out
str Src Message Message2 zipcode url
zipcode="08620" ;;enter your zipcode here
str Forecast
url.from("http://www.weather.com/weather/local/" 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")
#32
Thanks a ton Gint!
#33
Looks like weather.com 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
#34
I use the mobile phone page to get my stuff now; it's real simple too.

http://xhtml.weather.com/xhtml/cc/zipcodehere
An old blog on QM coding and automation.

The Macro Hook
#35
Agreed Ken. Thanks for this.
Matt B
#36
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:
http://nws.noaa.gov

or go straight to the rss page:
http://www.weather.gov/rss/

Here is the link for Chicago:
http://forecast.weather.gov/MapClick.php...tType=dwml
As you can see you'll need to know your latitude and longitude and then tack "&FcstType=dwml" on the end.
Geocode? Try this: http://stevemorse.org/jcal/latlonbatch. ... 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: 2 Guest(s)