Assuming I have an Amazon product URL like so
http://www.amazon.com/Kindle-Wireless-Reading-Display-Generation/dp/B0015T963C/ref=amb_link_86123711_2?pf_rd_m=ATVP
You can scrape ASIN codes from the data-asin attribute in the search results using XPath.
data-asin
For example $x('//@data-asin').map(function(v,i){return v.nodeValue}) can be ran in Chrome's console.
$x('//@data-asin').map(function(v,i){return v.nodeValue})