Details
There are a couple of approaches to this. I went with the simplest one. I used the Perl script at the end to identify how many books are there for the two topic I'm interested in.
For example:
mindshare.pl Perl Python
returns
714 - Perl
275 - Python
There are limitations to this of course. Perl is older than python so this may not be a fair comparison.
After all:
mindshare.pl Python Cobol
returns
706 - Cobol
275 - Python
So this script may need to be tweaked depending on your need.
Possibilities could include:
1. books are weighted depending on their amazon rank
2. Only consider books written in the last few years.
Another idea might be to graph the number of books published each year for the topics you're interested in.
Here's the script:
#!/usr/bin/perl -w
# amazon_mindshare.cgi
# This implementation by Tommie Jones
# Based on an idea by Steven Johnson
# http://www.stevenberlinjohnson.com/movabletype/archives/000009.html
use lib qw(/usr/home/tj/public_html/modules);
use strict;
use LWP::Simple;
use XML::Simple;
use Data::Dumper;
my ($competitor1,$competitor2)=@ARGV;
# Your Amazon API developer's key
my $amazon_key='Put you key here';
if ($competitor1 and $competitor2) {
my $request_tmpl="http://aws-beta.amazon.com/onca/xml?Service=AWSProductData&SubscriptionId=AMAZON_KEY&Operation=ItemSearch&SearchIndex=Books&Keywords=KEYWORDS";
$request_tmpl=~ s/AMAZON_KEY/$amazon_key/g;
my $request=$request_tmpl;
$request=~ s/KEYWORDS/$competitor1/g;
my $results_competitor1 = XMLin(get($request));
$request=$request_tmpl;
$request=~ s/KEYWORDS/$competitor2/g;
my $results_competitor2 = XMLin(get($request));
my $competitor1_count=$results_competitor1->{Items}->{TotalResults};
my $competitor2_count=$results_competitor2->{Items}->{TotalResults};
print "$competitor1_count - $competitor1 \n";
print "$competitor2_count - $competitor2 \n";
}