1
2
3
4
5
6
7
8
my $url = 'https://blockchain.info/address/1Q8VghUJkNeFnaKy553b9buUWKxFYL579G';
use LWP::Simple;
my @lines = get $url;
$string = "final_balance";
foreach $line (@lines) {
if ($line =~ $string) { print "$line"; }
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/usr/bin/perl use 5.010; use strict; use warnings; use Mojo::UserAgent; my $ua = Mojo::UserAgent->new; my ($btc) = $ua->get("https://blockchain.info/address/1Q8VghUJkNeFnaKy553b9buUWKxFYL579G") ->res ->dom ->find("#final_balance > font > span") ->map("text") ->each; say $btc;
$ perl -Mojo -E 'say g("https://blockchain.info/address/1Q8VghUJkNeFnaKy553b9buUWKxFYL579G")->dom->find("#final_balance > font > span")->map("text")->each'
1 2 3 4 5 6 7 8 9 10 11
#!/usr/bin/perl use 5.010; use strict; use warnings; use Web::Query; my $url = 'https://blockchain.info/address/1Q8VghUJkNeFnaKy553b9buUWKxFYL579G'; say Web::Query->new($url)->find('#final_balance > font > span')->text;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/usr/bin/perl use 5.010; use strict; use warnings; use Mojo::UserAgent; my $ua = Mojo::UserAgent->new; my $dom = $ua->get("https://blockchain.info/address/1Q8VghUJkNeFnaKy553b9buUWKxFYL579G") ->res ->dom; my @wanted = ( "final_balance", "total_received" ); for my $what ( @wanted ) { my ($wanted) = $dom ->find("#$what > font > span") ->map("text") ->each; say "$what: $wanted"; }