Amazon Web Services

davorg on 2002-07-17T16:03:43

Given that Amazon have announced a web services interface to their database, here's the basis of an updated version of tchrist's amarank.

use LWP::Simple;
use XML::XPath;

my $am_key = 'XXXXXXXXXXXXX'; # your key here

my $url = 'http://xml.amazon.com/onca/xml?v=1.0&t=webservices-20&dev-t=$am_key&AsinSearch=%%ASIN%%&type=heavy&f=xml';

while () {
  chomp;
  my $req = $url;
  $req =~ s/%%ASIN%%/$_/;

  my $xml = get $req;

  warn "$_: no response\n", next unless $xml;

  my $xp = XML::XPath->new(xml => $xml);

  print $xp->findvalue('/ProductInfo/Details/ProductName'), ' - ';
  print join(', ',
             map { $_->findvalue('.') }
               $xp->findnodes('/ProductInfo/Details/Authors/Author')),
        "\n";
  print 'Rank: ', $xp->findvalue('/ProductInfo/Details/SalesRank'), "\n";
}
__END__
1930110006
0596000278


Cool application already

Fletch on 2002-07-18T15:41:17

Someone's put Google's UI on top of Amazon's interface: http://www.kokogiak.com/amazon/

Attribution oops

Fletch on 2002-07-18T15:43:21

Credit to Coral on IRC for finding that.