Scraping ASIN codes from Amazon is easier than you think. Okay, you can manually grab the ASIN codes from product pages URLs, but you can also get them from the search results too.

This can be done with an Amazon page, and a little XPath query. Fortunately, you can run XPath queries in Chrome, so you don’t have to install anything out of the ordinary.

Don’t worry if you’re not the most technically gifted, it’s easy to do, and I’ve included the code for you below!

Find an Amazon page to scrape

Open up Amazon, and a search for a keyword. Once the page has loaded up, you’ll see a bunch of items, and we’ll get to the scraping.

Make sure that the page that you’ve opened is a search results page. There’s no point mass scraping a single product page. Just copy the ASIN from the URL instead.

Note that each of the product listing element’s has a stored “data-asin”

Inspect element (right-click, click Inspect Element) on ones of the product listings, and you’ll see that there’s a “data-asin” attribute, with the product’s ASIN.

amazon inspect element data-asin
Inspect element on a product in the search results to find the data-asin attribute.

It might not be immediately obvious, but it’ll be there. Just goto the parent container of the HTML element.

Scrape ASIN codes with Chrome, jQuery & xPath

Next to the “elements” tab, in the inspect element panel, there’s a tab called “Console”.

You’ll now be able to type in Javascript queries and run them on the site by writing or pasting code in here.

$x('//@data-asin').map(function(v,i){return v.nodeValue})

You can paste in the above code, and it’ll scrape all the ASIN codes on the page.

Then, after you paste in the code, you’ll see a preview of the returned values. These should be the ASIN codes that you’re searching for.

Press enter and you’ll have a nicely formatted list of ASIN codes, freshly scraped for your usage!

If you have any questions, fire away in the comments below.

Until next time,

Leave a Reply
You May Also Like

5 Solid Reasons Why You Should Be Branding Yourself on Snapchat

Snapchat‘s been around for a while, I have used it a lot…

How To Make Money from Pokemon-Go Going Viral

I think everyone’s heard about the new Pokémon game that’s just come…

CPA: I Quit CPA Content Locking for a Few Reasons

I first found out about CPA at a pretty young age. When I started pushing locked content monetized by CPAGrip. But there was always this feeling of wrong-doing when I pushed CPA.

Hack This Site: Realistic 1 Solution

This is a simple step-by-step solution guide for Realistic Mission 1 on…