From 19f59cb0aa5e09a525af16353776259353e0e7c3 Mon Sep 17 00:00:00 2001 From: Matthew Slowe Date: Mon, 10 Jun 2019 21:48:11 +0100 Subject: [PATCH] update where data comes from to get it from the JSON blob rather than the body --- new.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/new.pl b/new.pl index dbe9162..0ffadec 100755 --- a/new.pl +++ b/new.pl @@ -67,10 +67,11 @@ foreach my $station (@stations) { $stationname = $stationdata->{'name'}; # $level = $leveldata->[0]->{_}; - $res->content =~ m~Latest recorded level (-?[\d\.]+)m~; - $level = $1; + $res->content =~ /"recentValue":{"ts":"([^"]+)","_":(\d+.\d+),"err":false}}/; + # $res->content =~ m~Latest recorded level (-?[\d\.]+)m~; + $level = $2; # $res->content =~ m~Recorded at (.*)~; - $res->content =~ m~Recorded at ([^<]+)<~; + # $res->content =~ m~Recorded at ([^<]+)<~; my $lastupdate_str = $1; $lastupdate = UnixDate($lastupdate_str, "%Y-%m-%dT%T.000Z"); # $lastupdate = UnixDate($leveldata->[0]->{ts}, "%Y-%m-%dT%T.000Z");