At the time of this writing, John Grisham's
novel A Painted House has 362 sellers offering
it in Amazon's Marketplace. There's probably some demand for the
book, but listing your copy for sale alongside 362 others is a bit of
a crapshoot. We can safely say that the supply has been met for the
demand.
Wouldn't it be nice if Amazon could just tell you which of your books
are in high demand? Well, they do—it just takes a bit of
digging. The trick is to find "buyer waiting" statuses for your
books.
If someone's on a product detail page and there are no Marketplace
listings for the item, they'll have the option to "Order it used."
Clicking this link doesn't really order the item from anyone, it just
lets Amazon know that someone is interested in buying that product
used. (They're then notified via email when someone offers the book
used.) Amazon, in turn, lets everyone else know that someone's
interested by including a "buyer waiting" message, like the one in
, right on the product detail page.
Figure 1. "Buyer waiting" message on the product detail page
You could visit the product detail page for every item you own and
see if any are in immediate demand, but if you own more than five or
six books or CDs, that's going to be a time-consuming process.
Instead, you can kick-start the process by visiting the
Sell Your Collection page. To get
there, go to the Your Store page (http://www.amazon.com/yourstore/) and click
"Sell Your Collection" under the "More to Explore" heading on the
lefthand side of the page.
The Sell Your Collection page lists all of the items you've purchased
through Amazon and any items you've told Amazon that you own . As you go through the
list you'll see yellow "Sell Yours Here" buttons that begin the
process of listing the item for sale . What you're really looking for,
though, are those items that show a "buyer waiting" message under
those buttons. By paging through your collection and scanning the
list, you can compile a list of the items that will probably
sell quickly.
TIP
The Sell Your Collection page also features Amazon's guess at what
your entire purchase history is worth. It uses 70% of the item's
current price to calculate the estimate, which might be high
depending on the condition and the competition.
If you haven't purchased all of your potential sale items through
Amazon, there's another way to speed up the process of finding wanted
books: Google. If you have the ASIN for your products (ISBN number
for books), you can use Google.com to search Amazon for the "buyer
waiting!" text on that item's product detail page. The Google query
to accomplish this looks something like this:
insert ASIN "buyer waiting!" site:www.amazon.com
This tells Google
to
search Amazon.com only for pages that contain the ASIN you provide
and the phrase "buyer waiting!" If you get a result, you know the
item is in demand. No result means the product detail page for that
ASIN doesn't have a "buyer waiting" status the last time Google
visited the page.
Doing this search is only marginally faster than visiting each
product detail page directly—which is what we're trying to
avoid. Google, like Amazon, has released a Web Services API, which
means developers can script searches and format the results quickly.
That's exactly what the following code does.
Running the Hack
This code requires a text file filled with ASINs. Simply create a
file called asins.txt and include one ASIN on
each line.
Once you have the ASINs file, you can run this script from a command
prompt, like so:
perl buyer_waiting.pl <insert asin text file location>
Google will be contacted through its API for each ASIN. If "buyer
waiting" is found on the appropriate Amazon page, the script will
query Amazon's API for the book title. Depending on how eclectic your
collection is, a list of 20 ASINs should turn up some with buyers
waiting. Each match will be printed out along with the ASIN like
this:
A buyer is waiting for Amazon Hacks! [0596005423]
A buyer is waiting for Google Hacks! [0596004478]
Now that you know exactly what people are looking for, you can
concentrate your efforts there.
The Code
To run this code you'll need a Google
developer's key. A key
is free and easy to obtain at http://www.google.com/apis/. This code
accepts the location of a text file on the command line. It should
contain a list of the ASINs you want to query Google for. Add the
following code
to a file called buyer_waiting.pl.
#!/usr/bin/perl
# buyer_waiting.pl
# A script to check Google/Amazon for waiting buyers.
# Usage: perl buyer_waiting.pl <asin file>
#Your Google API developer's key
my $google_key='insert Google developer key';
#Location of the GoogleSearch WSDL file
my $google_wdsl = "http://api.google.com/GoogleSearch.wsdl";
#Your Amazon Developer's token
my $dev_token = 'insert Amazon developer token';
#Your Aassociates Tag
my $af_code = 'insert associates tag';
use strict;
#Set the necessary Perl modules
use SOAP::Lite;
use XML::Simple;
use LWP::Simple;
#Take the query from the command-line
my $asinfile = shift @ARGV or die "Usage:perl buyer_waiting.pl [RETURN]
<asin file>\n";
#Create a new SOAP::Lite instance,feeding it GoogleSearch.wsdl
my $google_search = SOAP::Lite->service($google_wdsl);
#Set a counter for the results
my $i = 0;
#Loop through the ASINs, performing a query for each
open(ASINFILE, "<".$asinfile);
while(<ASINFILE>) {
my($asin) = $_;
chomp($asin);
#Build Google Query
my $query = $asin . " \"buyer waiting!\" site:www.amazon.com";
#Send Query Google Request
my $results = $google_search ->doGoogleSearch($google_key,[RETURN]
$query,0,10,"false","","false","","latin1","latin1");
#Loop through any results
foreach my $result (@{$results->{resultElements}}){
$i++;
#Get Title from Amazon
my $url = "http://xml.amazon.com/onca/xml3?t=" . $af_code .
"&dev-t=" . $dev_token .
"&type=lite&f=xml&" .
"AsinSearch=" . $asin;
my $content = get($url);
die "Could not retrieve info for $asin" unless $content;
my $xmlsimple = XML::Simple->new( );
my $response = $xmlsimple->XMLin($content);
my $title = $response->{Details}->{ProductName};
#Print out the tile
print "A buyer is waiting for " . $title .
" [" . $asin . "]\n";
}
}
if ($i == 0) {print "No buyers waiting for these items.\n"};