Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

davorg (18)

Yahoo! ID: daveorguk (Add User, Send Message)

Hacker, author, trainer

Technorati Profile []

Journal of davorg (18)

Wednesday July 17, 2002
11:03 AM

Amazon Web Services

[ #6421 ]

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 = '$am_key&AsinSearch= %%ASIN%%&type=heavy&f=xml';

while (<DATA>) {
  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('.') }
  print 'Rank: ', $xp->findvalue('/ProductInfo/Details/SalesRank'), "\n";

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.