|
PLACES TO GO:
|
|
AMAZON
#!/usr/bin/perl -w
use strict;
use Net::Amazon;
####################################################################
# AMAZON - A lookup utility for looking up books and generating
# Associate referral links on Amazon.com'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 the titles and authors and creating
# a link to that book with the referral Associate ID embedded.
#
# SYNTAX: perl amazon.pl place keywords here (no quotes required)
#
# REQUIRED: Net::Amazon module
# Amazon developer token (http://amazon.com/soap)
# Associate ID (http://amazon.com/associates)
#
# CONTACT: Questions, comments, etc.
# http://www.nathanpralle.com/contact.html
####################################################################
########################
# CONFIGURATION OPTIONS
my $AMAZON_DEVELOPER_KEY='YOUR_DEV_KEY_HERE';
my $ASSOCIATE_ID='YOUR_ASSC_ID_HERE';
#######################
my $limit=5;
my $lookup=join(" ",@ARGV);
my $ua=Net::Amazon->new(token=>$AMAZON_DEVELOPER_KEY);
my $response=$ua->search(keyword => "$lookup", mode => "books");
if($response->is_success()) {
foreach my $i($response->properties()){
if($limit>0){
print "\"".$i->title()."\" by ".$i->author()."\n";
print "http://www.amazon.com/exec/obidos/ASIN/".$i->Asin()."/$ASSOCIATE_ID\n\n";
}
$limit--;
}
}
else {
print "Error: ", $response->message(), "\n";
}
exit;
This site and all content (C)2002-2008 Nathan E. Pralle (www.nathanpralle.com).
|