Code Monkey home page Code Monkey logo

amazon-bot's Introduction

Amazon Bot

A bot to programatically purchase physical items on Amazon. Returns promises.

Disclaimer

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.

Installation

npm install amazon-bot --save

Usage

Usage comes here

constructor

AmazonBot(tld, timeout = 5000)

tld is the Amazon top level domain you want to use, timeout defaults to 5000 which is also the pahntomjs default

Methods

login(username, password)

Login with Amazon username and password - Resolves when login succeeds.

logout()

Logout - Resolves when logout succeeds.

close()

Closes phantom JS, call this when you are done taking actions

addItem(id)

Add a single item by its product id - Resolves when item could be added

addItems(ids)

Add multiple items at once. ids is an array of product id's - Resolves when items could be added

removeItem(id)

Removes an item from the cart by its product id - Resolves when item could be removed

removeItems(ids)

Removes multiple items from the cart at once. ids is an array of product id's - Resolves when items could be removed

getCart()

Get details about all items in the shopping cart - Resolves when cart information is available

getCartTotal()

Get a summary of all items in the shopping cart - Resolves when cart information is available

clearCart()

Remove all items from the shopping cart - Resolves when succeeded in removing items from the cart

redeem(code)

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

getBalance()

Get the current balance - Resolves when succeeded in obtaining balance

getTotal()

Get the current cart total including shipping - Resolves when payment information is available and succeeded in obtaining total

getAddresses()

Get all available addresses - Resolves when address information is available

Functionality

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.

Testing

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.

Todo

  • checkout with id for address

amazon-bot's People

Contributors

stylesuxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

amazon-bot's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.