12 my $url = 'http://www.wetter.at/wetter/oesterreich/tirol/obsteig';
13 my $response = HTTP::Tiny->new->get($url);
15 # don't die. the server returns 500 _and_ a valid content.
16 # die "Failed to get '$url'.\n" unless $response->{success};
18 my $body = $response->{content};
21 process "div.dayInfo", "dayInfo" => "TEXT";
22 process "span.sunUp", "sunUp" => "TEXT";
23 process "span.sunDown", "sunDown" => "TEXT";
24 process "div.boxNow", "boxNow" => scraper {
25 process "div.title", "title" => "TEXT";
26 process "div.temp", "temp" => "TEXT";
27 process "div.icontext", "icontext" => "TEXT";
28 process "div.rain", "rain" => "TEXT";
33 my $res = $s->scrape($body);
35 my $timeregexp = qr/^.*?([0-9:]+).*?$/;
37 ( my $date = $res->{dayInfo} ) =~ s/^.*, (\d+)\.(\d+)\.(\d+)$/$3-$2-$1/;
38 ( my $time = $res->{boxNow}->{title} ) =~ s/$timeregexp/$1/;
39 ( my $sunup = $res->{sunUp} ) =~ s/$timeregexp/$1/;
40 ( my $sundown = $res->{sunDown} ) =~ s/$timeregexp/$1/;
41 ( my $temp = $res->{boxNow}->{temp} )
42 =~ s/Â?°//; # real °, and "something" before?!
43 my ( $weather, $clouds )
44 = $res->{boxNow}->{icontext} =~ m|^([^(]+)\((\d+)% .*$|;
46 = $res->{boxNow}->{rain} =~ m|Niederschlag: (.+)Wind: (.+)|;
47 $weather = decode( "utf8", $weather );
50 say 'Wetter in Obsteig (von wetter.at)';
51 say '---------------------------------';
54 say "Sonne↑:\t$sunup";
55 say "Sonne↓:\t$sundown";
59 say "Wetter:\t$weather";
60 say "Bewölk:\t$clouds%";
63 say "$date;$time;$sunup;$sundown;$temp;$rain;$wind;$weather;$clouds";
69 wetter.at.pl - show weather information about Obsteig from wetter.at
71 =head1 COPYRIGHT AND LICENSE
73 Copyright 2017-2018, gregor herrmann <gregor@toastfreeware.priv.at>
75 Released under the same terms as Perl 5.