update where data comes from to get it from the JSON blob rather than the body

This commit is contained in:
Matthew Slowe 2019-06-10 21:48:11 +01:00
parent 731e7e6f3e
commit 19f59cb0aa

7
new.pl
View File

@ -67,10 +67,11 @@ foreach my $station (@stations) {
$stationname = $stationdata->{'name'}; $stationname = $stationdata->{'name'};
# $level = $leveldata->[0]->{_}; # $level = $leveldata->[0]->{_};
$res->content =~ m~Latest recorded level <strong class="bold-small">(-?[\d\.]+)m~; $res->content =~ /"recentValue":{"ts":"([^"]+)","_":(\d+.\d+),"err":false}}/;
$level = $1; # $res->content =~ m~Latest recorded level <strong class="bold-small">(-?[\d\.]+)m~;
$level = $2;
# $res->content =~ m~Recorded at (.*)~; # $res->content =~ m~Recorded at (.*)~;
$res->content =~ m~Recorded at ([^<]+)<~; # $res->content =~ m~Recorded at ([^<]+)<~;
my $lastupdate_str = $1; my $lastupdate_str = $1;
$lastupdate = UnixDate($lastupdate_str, "%Y-%m-%dT%T.000Z"); $lastupdate = UnixDate($lastupdate_str, "%Y-%m-%dT%T.000Z");
# $lastupdate = UnixDate($leveldata->[0]->{ts}, "%Y-%m-%dT%T.000Z"); # $lastupdate = UnixDate($leveldata->[0]->{ts}, "%Y-%m-%dT%T.000Z");