I have links like this:
<div class="zg_title">
<a href="https://rads.stackoverflow.com/amzn/click/com/B000O3GCFU" rel="nofollow noreferrer">Thermos Foogo Leak-Proof Stainless St...</a>
</div>
And I'm scraping them like this:
product_asin = product.xpath('//div[@class="zg_title"]/a/@href').first.value
The problem is that it takes the whole URL and I want to just get the ID:
B000O3GCFU
I think I need to do something like this:
product_asin = product.xpath('//div[@class="zg_title"]/a/@href').first.value[ReGEX_HERE]
What's the simplest regex I can use in this case?
EDIT:
Strange the link URL doesn't appear complete:
http://www.amazon.com/Thermos-Foogo-Leak-Proof-Stainless-10-Ounce/dp/B000O3GCFU/ref=zg_bs_baby-products_1