Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Amazon Helpers Build Status

Tiny helper library to extract an ASIN/ISBN number from an Amazon URL or create a (optionally localized) Amazon URL out of an ASIN/ISBN.

Installation

npm install amazon-helpers

or

yarn add amazon-helpers

Usage

Just require the library like any other npm module:

var amazonHelpers = require('amazon-helpers');

Methods

.getIdent(urlOrAsin)

amazonHelpers.getIdent('http://www.amazon.com/gp/product/B000MTST70/')

=> B000MTST70


.getProductUrl(urlOrAsin[, tld])

amazonHelpers.getProductUrl('B000MTST70')

=> http://www.amazon.com/dp/B000MTST70

You can specify a TLD as second argument to convert your URL to another country amazonHelpers.getProductUrl('http://www.amazon.com/dp/B000MTST70', 'co.uk')

=> http://www.amazon.co.uk/dp/B000MTST70

Attention: The library does not check if the product exists in the given TLD!


.getIdentByUrl(urlOrAsin)

amazonHelpers.getIdentByUrl('http://amazon.com/gp/product/B00L3KNWBU')

=> { asin: 'B00L3KNWBU', tld: 'com' }


For more examples have a look at the tests.

License

MIT.

About

Some tiny helper functions for amazon

Resources

Stars

9 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages