API::Flickr
検索して画像のアドレスをはきます。
検索ワードは"Kagawa"になってる。
flickr.pl
#!/usr/bin/perl use strict; use LWP::Simple; use XML::Simple; use Data::Dumper; my $apikey = "your_apikey"; my $baseurl = "http://www.flickr.com/services/rest/"; my $params = "?method=flickr.photos.search&format=rest&api_key=$apikey&text=Kagawa"; my $url = $baseurl.$params; my $content = get($url); my $xml = XMLin($content); #print Dumper($xml); my ($farm,$server,$secret,$imgurl); foreach my $key (keys %{$xml->{photos}{photo}}){ #print Dumper($xml->{photos}{photo}{$key}); $farm = $xml->{photos}{photo}{$key}{farm}; $server = $xml->{photos}{photo}{$key}{server}; $secret = $xml->{photos}{photo}{$key}{secret}; $imgurl = "http://farm".$farm.".static.flickr.com/$server/$key"."_".$secret.".jpg"; print $imgurl."\n"; } 1;
ref
Flickrのウェブサービス(API)の使い方入門|HP(株・投資情報etc)の補助ブログ
Flickr Services: Flickr API: flickr.photos.search