Ruby Script to parse ISBNs listed in R-Project to populate an Amazon

June 7, 2010

(This article was first published on R-Chart, and kindly contributed to R-bloggers)

As you probably figured out, I am an Amazon affiliate and have been giving some thought to how to get the best lists of R books available at Amazon. To get the list of ISBNs from R-Project, the following Ruby script did the trick:

require 'rubygems'
require 'open-uri'
require 'hpricot'



entry.inner_text.split("\n").each{|l|isbns << l=~/ISBN/}
['.', ':', '-', 'ISBN',', in German',', in Czech'].each{|e|



puts isbns.join('|')

The pipe-delimited list could then be supplied in this Amazon Search Page. If you are interested in seeing the result, click here.

To leave a comment for the author, please follow the link and comment on his blog: R-Chart. offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...


Comments are closed.