|
PLACES TO GO:
|
|
BOOKLOOKUP
#!/usr/bin/perl -w
use strict;
use Net::Amazon;
use Term::ReadKey;
####################################################################
# BOOKLOOKUP - A lookup utility for looking up books and book information
# on Amazon's database
# Copyleft 2005 - Nathan E. Pralle
#
# DESCRIPTION: This utility is used for looking up a book's title, author, subject,
# keyword, whatever and then listing comprehensive details on that book.
#
# SYNTAX: perl booklookup.pl place keywords here (no quotes required)
#
# REQUIRED: Net::Amazon module
# Amazon developer token (http://amazon.com/soap)
#
# CONTACT: Questions, comments, etc.
# http://www.nathanpralle.com/contact.html
####################################################################
########################
# CONFIGURATION OPTIONS
my $AMAZON_DEVELOPER_KEY='YOUR_DEV_ID_HERE';
#######################
my $lookup=join(" ",@ARGV);
my $hits=0;
my $totalhits=0;
if($lookup eq ""){
print "You must enter some keywords to search on!\n";
exit;
}
my $ua=Net::Amazon->new(token=>$AMAZON_DEVELOPER_KEY);
my $response=$ua->search(keyword => "$lookup", mode => "books");
if($response->is_success()) {
foreach my $g($response->properties()){
if($g->Catalog eq "Book"){
$totalhits++;
}
}
print "\n\nTOTAL HITS FOR SEARCH: $totalhits\n\n";
foreach my $i($response->properties()){
if($i->Catalog() eq "Book"){
$hits++;
print "HIT: ".$hits."\n";
print "TITLE: ".$i->title()."\n";
print "AUTHORS: ".$i->author()."\n";
print "PUBLISHER: ".$i->publisher()."\n";
print "YEAR: ".$i->year()."\n";
print "MEDIA: ".$i->Media()."\n";
print "ISBN: ".$i->isbn()."\n";
print "ASIN: ".$i->Asin()."\n";
print "AVAILABLE: ".$i->Availability()."\n";
print "LIST PRICE: ".$i->ListPrice()."\n";
print "OUR PRICE: ".$i->OurPrice()."\n";
print "USED PRICE: ".$i->UsedPrice()."\n";
print "SALES RANK: ".$i->SalesRank()."\n\n";
print "** PRESS ENTER FOR NEXT ENTRY OR CTRL-C TO EXIT ***";
my $key;
while(not defined($key=ReadKey(-1))){
#no key yet
}
print "\n";
}
}
}
else {
print "Error: ", $response->message(), "\n";
}
This site and all content (C)2002-2008 Nathan E. Pralle (www.nathanpralle.com).
|