Yes, the website changed. This is why screen scrapers suck.
I've already fixed mine.
I started fixing the regex's and doing the math if the metric equivalents were not provided. Got about halfway done. Also, looked at the mobile version (which has simpler HTML to parse) and the XML api, before realizing how to change it back (the cookie)
Yog, both the mobile version or the cookie fix require a couple more lines of fix. Basically, the current script uses HTTP/0.9. You need at least HTTP/1.0 for either HTTP virtual hosting or cookies.
Here's a sample diff, you'll need to do this in about 3 or 4 places:
Code: Select all
--- weather4.2.4.tcl.orig 2008-05-30 06:00:02.000000000 -0700
+++ weather4.2.4.tcl 2008-12-18 14:16:29.000000000 -0800
@@ -870,7 +887,10 @@
close $wzsock
return 0
}
- puts $wzsock "GET $pn_url"
+ puts $wzsock "GET $pn_url HTTP/1.0"
+ puts $wzsock "Host: www.wunderground.com"
+ puts $wzsock "Cookie: Units=both"
+ puts $wzsock ""
flush $wzsock
while {![eof $wzsock]} {
set http [gets $wzsock]
I also fixed the weather forecasts, which have been broken for quite some time (in a semi-hacky way that makes international forecasts work as well), and added IATA codes as well as tidy up the ICAO code detector a bit.
The reason I didn't just spend the time to use either the XML or mobile screens is because there is some data not available on those (current time) that I find useful (yea I should get a time script for time, and then I can ditch that). I thought about making two requests, one to get the time, and one to parse the mobile version, but I couldn't bring myself to resort to that inefficiency. And then I found the cookie fix which was quick enough. Also, XML isn't a guarantee of non-breakage either, though there is less for them to change (field names, formats, but not layouts or div tags)
By the way, I noticed this in the headers for weather4.tcl and onward.
Code: Select all
## Derivative works based on this script (whole or in part) are not allowed.
## Use murf's 3.4.1 (which he released under GPL) to create your own scripts.
I haven't been able to find any proof of license for murf's script (which I've used since 3.2 back in 2002) in the script or in any of the still-around places . Nor could I find it in the archive of murf's
webpage
I have also seen and used Dragnlord's versions since then up through 4 (I decided if i was going to fix 4 today, I might as well fix 4.2.4). I believe that all of Dragnlord's versions are derivative works of murf's, which would make them GPL'd as well. Or, if it wasn't GPL'd, then any derivative work from murf's would be just as not allowed. (disclaimer: I am not a lawyer)