$ pwd
/home/hogan/mojo
$ ls
1.button.pl 5.3.elev.debug.pl 5.3.elev.pl
$
####
2020/12/11 10:45:52 INFO ./3.mojo_fermi.pl
2020/12/11 10:45:53 INFO i is 0 ==============
2020/12/11 10:45:53 INFO
2020/12/11 10:45:53 INFO i is 1 ==============
2020/12/11 10:45:53 INFO
2020/12/11 10:45:53 INFO i is 2 ==============
2020/12/11 10:45:53 INFO
2020/12/11 10:45:53 INFO i is 3 ==============
2020/12/11 10:45:53 INFO
2020/12/11 10:45:53 INFO i is 4 ==============
2020/12/11 10:45:53 INFO
Sky above 45°31'5"N 122°40'33"W at Fri 2020 Dec 11 18:45
snip
Ephemeris:
| | Right Ascension | Declination | Distance (AU) | From 45°31'5"N 122°40'33"W: |
| Altitude | Azimuth |
| Sun | 17h 17m 17s | −23° 4.4' | 0.985 | 19.130 | −19.052 | Up |
| Mercury | 16h 56m 57s | −23° 19.1' | 1.438 | 19.910 | −14.157 | Up |
| Venus | 15h 32m 32s | −17° 41.8' | 1.480 | 26.501 | 7.028 | Up |
| Moon | 14h 35m 51s | −11° 41.4' | 57.0 ER | 29.801 | 23.591 | Up |
| Mars | 1h 12m 37s | +8° 4.4' | 0.725 | −24.754 | −133.649 | Set |
| Jupiter | 20h 2m 11s | −20° 57.3' | 5.841 | 3.667 | −54.781 | Up |
| Saturn | 20h 6m 43s | −20° 37.7' | 10.733 | 3.271 | −55.819 | Up |
| Uranus | 2h 20m 0s | +13° 28.6' | 19.043 | −26.910 | −152.851 | Set |
| Neptune | 23h 18m 20s | −5° 39.9' | 29.945 | −17.891 | −100.409 | Set |
| Pluto | 19h 41m 19s | −22° 34.9' | 34.999 | 5.255 | −49.911 | Up |
snip
2020/12/11 10:45:53 INFO i is 5 ==============
2020/12/11 10:45:53 INFO
##
##
#!/usr/bin/perl
use strict;
use warnings;
use Mojo::URL;
use Mojo::Util qw(dumper);
use Mojo::UserAgent;
use Data::Dump;
use Log::Log4perl;
use 5.016;
use Mojo::DOM;
my $log_conf3 = "/home/hogan/Documents/hogan/logs/conf_files/3.conf";
my $log_conf4 = "/home/hogan/Documents/hogan/logs/conf_files/4.conf";
#Log::Log4perl::init($log_conf3); #debug
Log::Log4perl::init($log_conf4); #info
my $logger = Log::Log4perl->get_logger();
$logger->info("$0");
my $site =
'https://www.fourmilab.ch/cgi-bin/Yoursky?z=1&lat=45.5183&ns=North&lon=122.676&ew=West';
# pretend to be a browser
my $uaname =
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36';
my $ua = Mojo::UserAgent->new;
$ua->max_redirects(5)->connect_timeout(20)->request_timeout(20);
$ua->transactor->name($uaname);
# find search results
my $dom = $ua->get($site)->res->dom;
# dd $dom; #overwhelms STDOUT
say "===========";
my @nodes = @$dom;
# c-style for is good for array output with index
for ( my $i = 0 ; $i < @nodes ; $i++ ) {
$logger->info("i is $i ==============");
$logger->info("$nodes[$i]");
}
sleep 2; #good hygiene
__END__
####
say 'Julian Day: ' . $dt->jd;
my $pturl = 'http://www.fourmilab.ch/cgi-bin/Yoursky?z=1&lat=45.5183&
+ns=North&lon=122.676&ew=West';
# you wanted Julian date so it looks like date should be '2' from the
+source.
my $tx = $ua->post( $pturl => form => { utc => $dt->jd, date => '2' }
+);
my $sunrow = $tx->res->dom->at('center:nth-of-type(3) table tr:nth-of-
+type(3)');
# output
say 'Name:' . $sunrow->children->[0]->all_text;
say 'Altitude: ' . $sunrow->children->[4]->text;
say 'Azimuth: ' . $sunrow->children->[5]->text;
say 'Visible: ' . $sunrow->children->[6]->text;