Skip to content

Commit

Permalink
Add get_asin function to AmzProduct
Browse files Browse the repository at this point in the history
  • Loading branch information
nfearnley authored Oct 21, 2018
1 parent d66005c commit 5594510
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions amzsear/core/AmzProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,11 @@ def get_prices(self, key=None):
prices += [re.sub(',','',x) for x in re.findall('[\d.,]+', self.prices[k])]

return sorted(map(float,prices))

def get_asin(self):
result = re.search('(?:/|%2F)dp(?:/|%2F)(B\d[0-9A-Z]{8})', self.product_url)
if result is not None:
result = result.group(1)
return result


0 comments on commit 5594510

Please sign in to comment.