22 lines
774 B
Bash
Executable File
22 lines
774 B
Bash
Executable File
#! /usr/bin/perl -w
|
|
use strict;
|
|
use warnings;
|
|
use JSON;
|
|
|
|
#Have to open the web page and look in developer mode to get this info
|
|
my $URL_lat = $ARGV[0] or scalar(40.48967);
|
|
my $URL_lng = $ARGV[1] or scalar(-111.93882);
|
|
my $URL_ProID = $ARGV[2] or scalar( 23);
|
|
my $URL_StatID = $ARGV[3] or scalar("C3430");
|
|
|
|
my $info = `curl -sm 5 "https://www.weatherbug.com/api/observation?lat=$URL_lat&lng=$URL_lng&providerId=$URL_ProID&stationId=$URL_StatID"` or die "Error";
|
|
|
|
my $json = decode_json $info or die "Error";
|
|
|
|
my $loc = %{$json}{"Station"}->{"StationId"};
|
|
my $temp = %{$json}{"Observation"}->{"Temperature"};
|
|
my $windS = %{$json}{"Observation"}->{"WindSpeedAvg"};
|
|
my $windD = %{$json}{"Observation"}->{"WindDirectionAvg"};
|
|
|
|
print "?:".$temp.":".$windS.":".$windD.":".$loc;
|