This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

DragnLord's weather script

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
rhn1379
Voice
Posts: 5
Joined: Sun Oct 12, 2008 9:00 pm

Post by rhn1379 »

DragnLord wrote:

Code: Select all

[Oct_15 3:01:36am] <WZ_Test>  Akron, Ohio -- 3:01 AM EDT Updated: 3:01 AM EDT on October 15, 2008
[Oct_15 3:01:37am] <WZ_Test>  Conditions: 58.4°F / 14.7°C | Overcast
[Oct_15 3:01:38am] <WZ_Test>  Humidity:  88%    Dew Point: 55°F / 13°C
[Oct_15 3:01:40am] <WZ_Test>  Pressure: 30.07in / 1018.2hPa (Falling)  Wind: Calm
The problem is apparently on your end somewhere.
I will make an attempt using a friend's machine, far far away from mine...and see if I get any of the same results...
User avatar
rhn1379
Voice
Posts: 5
Joined: Sun Oct 12, 2008 9:00 pm

Post by rhn1379 »

rhn1379 wrote:
DragnLord wrote:

Code: Select all

[Oct_15 3:01:36am] <WZ_Test>  Akron, Ohio -- 3:01 AM EDT Updated: 3:01 AM EDT on October 15, 2008
[Oct_15 3:01:37am] <WZ_Test>  Conditions: 58.4°F / 14.7°C | Overcast
[Oct_15 3:01:38am] <WZ_Test>  Humidity:  88%    Dew Point: 55°F / 13°C
[Oct_15 3:01:40am] <WZ_Test>  Pressure: 30.07in / 1018.2hPa (Falling)  Wind: Calm
The problem is apparently on your end somewhere.
I will make an attempt using a friend's machine, far far away from mine...and see if I get any of the same results...
Ok, this is odd, I was able to get it to work on his machine...LOL.

I use a windrop, he uses an eggdrop. Maybe there's something with Window that's preventing it. Who knows. thank you anyways. :)
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

The results I showed are from a windrop.
Your problem is specific to your machine.
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

rhn1379 wrote:
rhn1379 wrote:
DragnLord wrote:

Code: Select all

[Oct_15 3:01:36am] <WZ_Test>  Akron, Ohio -- 3:01 AM EDT Updated: 3:01 AM EDT on October 15, 2008
[Oct_15 3:01:37am] <WZ_Test>  Conditions: 58.4°F / 14.7°C | Overcast
[Oct_15 3:01:38am] <WZ_Test>  Humidity:  88%    Dew Point: 55°F / 13°C
[Oct_15 3:01:40am] <WZ_Test>  Pressure: 30.07in / 1018.2hPa (Falling)  Wind: Calm
The problem is apparently on your end somewhere.
I will make an attempt using a friend's machine, far far away from mine...and see if I get any of the same results...
Ok, this is odd, I was able to get it to work on his machine...LOL.

I use a windrop, he uses an eggdrop. Maybe there's something with Window that's preventing it. Who knows. thank you anyways. :)
I have both eggdrop and windrop and it works fine.... I guess you didn't add the required egg http package in the conf
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

cache wrote: I have both eggdrop and windrop and it works fine.... I guess you didn't add the required egg http package in the conf
No such thing required.
My script is not dependent upon additional packages.
C
Crow50
Voice
Posts: 8
Joined: Tue Jun 03, 2008 8:10 am

Variable Error

Post by Crow50 »

.wz (zipcode) I get = Tcl error [pub_wz]: can't read "mtemp": no such variable
M
Moonster
Halfop
Posts: 95
Joined: Wed Nov 13, 2002 5:39 pm
Location: Manchester NH USA
Contact:

Re: Variable Error

Post by Moonster »

Crow50 wrote:.wz (zipcode) I get = Tcl error [pub_wz]: can't read "mtemp": no such variable
I am getting the same error. Wonder if they changed the website again.....
"Knowledge is Power"
BeastNH/Moonster on Undernet/EFnet IRC Network
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Re: Variable Error

Post by cache »

Moonster wrote:
Crow50 wrote:.wz (zipcode) I get = Tcl error [pub_wz]: can't read "mtemp": no such variable
I am getting the same error. Wonder if they changed the website again.....
Same here
r
redwolf
Voice
Posts: 17
Joined: Tue Jun 26, 2007 11:24 pm

error

Post by redwolf »

same here, worked last night
r
redwolf
Voice
Posts: 17
Joined: Tue Jun 26, 2007 11:24 pm

update soon???

Post by redwolf »

is dragonlord going to update soon?
User avatar
GrumpyBear
Voice
Posts: 3
Joined: Wed Dec 17, 2008 7:11 pm
Location: Care-a-Lot

Post by GrumpyBear »

hmm, the website he hosted the script on is gone. the domain doesnt even work, and he hasnt posted in over a month... wonder if he is still working on the script...?

and I also am receiving that same error.
User avatar
GrumpyBear
Voice
Posts: 3
Joined: Wed Dec 17, 2008 7:11 pm
Location: Care-a-Lot

Post by GrumpyBear »

Does his script take data directly from the webpage? or does it use XML data? cause it seems scripts that extract data using the XML method dont need to be updated to rely on webpage code to work... ???
Y
Yog
Voice
Posts: 3
Joined: Thu Dec 18, 2008 4:32 pm

Post by Yog »

The problem appears to be that the script expects the HTML output to include both degrees F and C, but wunderground changed the way this works so that this is now a preference handed to their web site from your browser via cookies.

The script uses it's own method to do the HTTP request, and I couldn't figure out how to successfully include a cookie in the HTTP request. I tried simply outputting "Cookie: Units=both" on the next line after the GET request, but that didn't seem to have an effect. There's probably something that must be done to properly format the HTTP request to make this work, but I didn't have time to work on it.

Hopefully Dragnlord will update this.

@Grumpybear: Yeah, the scripts, all scripts like this really, should be updated to use the api.wunderground.org XML output. SO much easier to parse than HTML output. I'm almost tempted to rewrite the script to use this. Almost. Maybe if I get some time.

@Dragnlord: Check this out: http://wiki.wunderground.com/index.php/API_-_XML
r
random2
Voice
Posts: 5
Joined: Thu Dec 18, 2008 8:00 pm

Post by random2 »

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)
r
redwolf
Voice
Posts: 17
Joined: Tue Jun 26, 2007 11:24 pm

hmm does anyone have a working script?

Post by redwolf »

i tried that random2 codes, i still get cant find mtemp...
Tcl error [pub_wz]: can't read "mtemp": no such variable
Post Reply