
Karamba Weather.COM
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
A Karamba Weather Theme,
note: in the time I wrote this, there wasn't any *good* weather karamba theme. Now, we are plenty of them.
I'd be glad if somebody uses it besides me!
This scripts collect info from http://www.weather.com
Please, follow directions in README to show the weather at your city.
Enjoy!!!
In short time, I'd realease a script in Spanish.
Please, check md5sum of the file
3dd96faef837a0a674e76d4a09af5203
karamba_weather.tar.gz
aiiee
11 years ago
Report
askoning
16 years ago
$url = "http://www.w3.weather.com/outlook/travel/local/" . $cityCode . "?";
works for me. (This is where one finally ends up after 3 normally unseen redirections.)
Report
janet
16 years ago
Report
AussieJohn
16 years ago
Using Mandrake10.OE. Have tried 8 times without success.
John
Report
AussieJohn
16 years ago
I am sorry but you are too vague to be of any help to most people which is a shame considering that judging by your screen shot, you have the most attractive panel.
John
Report
axialix
16 years ago
Report
elegos
16 years ago
I'm italian, I live in Milan..
So I changed the code to
$cityCode = "ITXX0042";
and nothing... so I also tried to change this:
$url = "www.weather.com/outlook/travel/local/" . $cityCode;
but nothing...
Report
hosti
16 years ago
Any suggestions ?
Report
uteck
16 years ago
Report
uteck
16 years ago
Can't open perl script "script/climaEn.pl": No such file or directory
Config File ~/.superkaramba/weather.rc written.
TypeError: reload() argument must be module
Report
laktose
17 years ago
is there any way i can fix this?
Report
sp00k113
16 years ago
Report
Dany303
17 years ago
my script:
#!/usr/bin/perl
#usage: perl /usr/share/karamba-0.17/themes/karamba_weather/script/clima.pl www.weather.com/weather/local/BLXX0006
use LWP::UserAgent;
use HTML::TokeParser;
#City code according to http://www.weather.com, please check the small README
$cityCode = "GMXX0131";
$url = "www.weather.com/outlook/travel/local/" . $cityCode ."?&setcookie=1";
#my $url = @ARGV[0];
my $ua = new LWP::UserAgent;
$url = "http://$url" unless($url =~ /^http:\/\//);
if($ENV{'http_proxy'}){
$ua->env_proxy;
$ua->proxy(http => $ENV{'http_proxy'});
}
my $req = new HTTP::Request 'GET',"$url";
# uncomment if you need it
# $req->quthorization_basic("user","pass");
my $res = $ua->request($req);
$res->is_success or die("didn't work $!");
my $page = $res->as_string;
$page =~ s/\°\;/
Report
quattro
17 years ago
$url = "www.weather.com/weather/local/" . $cityCode;
To:
$url = "www.w3.weather.com/weather/local/" . $cityCode;
Notice the addition of .w3
Report
angelrod
17 years ago
My script climaEn.pl :
#!/usr/bin/perl
#usage: perl /usr/share/karamba-0.17/themes/karamba_weather/script/clima.pl www.weather.com/weather/local/BLXX0006
use LWP::UserAgent;
use HTML::TokeParser;
#City code according to http://www.weather.com, please check the small README
$cityCode = "MXGO0035";
$url = "www.w3.weather.com/outlook/travel/local/" . $cityCode ."?&setcookie=1";
#my $url = @ARGV[0];
my $ua = new LWP::UserAgent;
$url = "http://$url" unless($url =~ /^http:\/\//);
if($ENV{'http_proxy'}){
$ua->env_proxy;
$ua->proxy(http => $ENV{'http_proxy'});
}
my $req = new HTTP::Request 'GET',"$url";
# uncomment if you need it
# $req->quthorization_basic("user","pass");
my $res = $ua->request($req);
$res->is_success or die("didn't work $!");
my $page = $res->as_string;
$page =~ s/\°\;//g;
$page =~ s/\ \;/ /g;
$page =~ s/Feels Like/Feels Like /g;
my $p = HTML::TokeParser->new(\$page);
$initPositionIcon = index ($page, "http://image.weather.com/web/common/wxicons/52/");
$endPositionIcon = index ($page," ", $initPositionIcon);
$nameIconFile = substr($page, $initPositionIcon + 47, $endPositionIcon -47 - $initPositionIcon);
while ( $token = $p->get_tag("td") ) {
my $text = $p->get_trimmed_text("/td");
if ($token->[1]{class}=~/obsInfo1/i) {
$report = $report . "$text\n";
}
if ($token->[1]{class}=~/obsInfo2/i) {
$report = $report . "$text\n";
}
if ($token->[1]{class}=~/obsReported/i) {
$reportHeader = "$text\n";
}
}
$endPositionCity = index ($reportHeader, "Last");
$textCity = substr ($reportHeader, 15, $endPositionCity -15);
$textUpdateTime = substr ($reportHeader, $endPositionCity, -1);
print $textCity . "\n";
print "pics/" . $nameIconFile . "\n";
print $report;
print $textUpdateTime . "\n";
Any hints?
Report
Stratz979
16 years ago
Report
angelrod
17 years ago
Any hints?
Report
omega527
17 years ago
Report
robint99
17 years ago
$url = "www.weather.com/outlook/travel/local/" . $cityCode ."?&setcookie=1";
Works for me, anyway.
Report
aplock
17 years ago
----
Can't locate object method "new" via package "URI" at /usr/local/lib/perl5/site_perl/5.8.0/HTTP/Request.pm line 121.
help help
help
Report
RaZoR14
17 years ago
if ($text =~ /
Report
maciunio
17 years ago
Thnx.
Report
rrichie
17 years ago
add this code :
$text =~ s!(\d+)!sprintf "%.0f", 100/(212-32) * ($1 - 32 )!e;
$text =~ s/
Report
ex-gnome
17 years ago
Report
iT3rr0r
17 years ago
it3rr0r@betsey2:~/karamba_weather$ $perl script/climaEn.pl www.weather.com/weather/local/BLXX000 6
Can't locate LWP/UserAgent.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux /usr/lib/p erl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux /usr/lib/perl5/site_perl/5.8.0 /usr/lib/per l5/site_perl .) at script/climaEn.pl line 3.
BEGIN failed--compilation aborted at script/climaEn.pl line 3.
im running slackware 9 BTW
Report