A bot to programatically purchase physical items on Amazon. Returns promises.
Use with caution - do not call checkout unless you are sure you want to really buy the stuff currently in your cart.
This library heavily relies on the Amazon page not changing. It is very likely that something breaks over time. Therefore an extensive test suite is provided.
npm install amazon-bot --save
Usage comes here
tld is the Amazon top level domain you want to use, timeout defaults to 5000 which is also the pahntomjs default
Login with Amazon username and password - Resolves when login succeeds.
Logout - Resolves when logout succeeds.
Closes phantom JS, call this when you are done taking actions
Add a single item by its product id - Resolves when item could be added
Add multiple items at once. ids is an array of product id's - Resolves when items could be added
Removes an item from the cart by its product id - Resolves when item could be removed
Removes multiple items from the cart at once. ids is an array of product id's - Resolves when items could be removed
Get details about all items in the shopping cart - Resolves when cart information is available
Get a summary of all items in the shopping cart - Resolves when cart information is available
Remove all items from the shopping cart - Resolves when succeeded in removing items from the cart
Redeem a gift code - Resolves when succeeded in redeeming a gift code Not tested with an actual gift code - if you do, please let me know in the issues
Get the current balance - Resolves when succeeded in obtaining balance
Get the current cart total including shipping - Resolves when payment information is available and succeeded in obtaining total
Get all available addresses - Resolves when address information is available
There is a lot functionality on the Amazon page that the bot does not support. Feel free to submit issues - or even better PR's, for functionality you want to see.
Since this is a scraper and relies on the Amazon page not changing, an extensive test suite is provided and may be invoked by running:
npm run test
Make sure you have your amazon login set as environment variables AMAZON_USER and AMAZON_PASS.
- checkout with id for address