--- aviation.pm.BAK     2017-05-13 10:10:28.507350161 -0400
+++ aviation.pm 2017-05-13 10:54:24.058901074 -0400
@@ -147,7 +147,9 @@
        return "For observations, ask me 'metar <code>'. For information on decoding Aerodrome Weather Observations (METAR), see http://www.avweb.com/weather/metartaf.html"
            if $site_id eq 'HELP';
 
-       my $metar_url = "http://weather.noaa.gov/cgi-bin/mgetmetar.pl?cccc=$site_id";
+#      my $metar_url = "http://weather.noaa.gov/cgi-bin/mgetmetar.pl?cccc=$site_id";
+       my $metar_url = "http://aviationweather.gov/adds/dataserver_current/httpparam?datasource=metars&requesttype=retrieve&format=csv&mostRecentForEachStation=constraint&hoursBeforeNow=2&stationString=$site_id";
+
 
        # Grab METAR report from Web.   
        my $agent = new LWP::UserAgent;
@@ -161,11 +163,12 @@
        return "Either $site_id doesn't exist (try a 4-letter station code like KAGC), or the NOAA site is unavailable right now." 
            unless $reply->is_success;
 
-       # extract METAR from incredibly and painfully verbose webpage
-       my $webdata = $reply->as_string;
-       $webdata =~ m/($site_id\s\d+Z.*?)</s;    
-       my $metar = $1;                       
-       $metar =~ s/\n//gm;
+       # new aviationweather.gov site changes fix by ken_flooterbuck@sizone.org 2017-05
+       # extract METAR from incredibly and painfully verbose webpage  ## csv is kinda nicer now from aviationweather.gov
+
+       my @webdata = split ("\n",$reply->{'_content'});
+       my @metars = split(",",$webdata[6]);
+       my $metar = $metars[0];
        $metar =~ s/\s+/ /g;
 
        # Sane?
