use strict;
use warnings;
use Flickr::API;
use Perl6::Say;
use XML::LibXML;
my $key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
my $secret = 'XXXXXXXXXXXXXXXX';
my $id = shift or die;
my $api = Flickr::API->new({
key => $key,
secret => $secret,
});
my $res = $api->execute_method('flickr.photos.getSizes', {
photo_id => $id,
});
my $doc = XML::LibXML->load_xml(string => $res->decoded_content);
say for map { $_->{source} }
sort { $b->{width} <=> $a->{width} }
map { +{width => $_->getAttribute('width'), source => $_->getAttribute('source')} }
$doc->findnodes('//size');