Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

All-in-one bot, with auto captcha-solving and proxy management, using Node.js and Puppeteer.

License

NotificationsYou must be signed in to change notification settings

samc621/SneakerBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

build, lint, test, deploy

This bot uses Node.js and Puppeteer to automate the checkout on various sneaker websites. It currently works on:

  1. Footsites (footlocker.com, footaction.com, eastbay.com, champssports.com)
  2. Shopify sites (e.g. BdgaStore, Concepts, Kith, etc.)
  3. Demandware sites (e.g. Adidas)
  4. Nike.com
  5. Supreme

About this project

This bot was made by developers, for developers. It is not a commercial product, it is a free and open source software. Thus, it may not be suitable for those with little or no software engineering experience.

The developers of this software should not be held liable for any lost opportunities resulting from its usage.

Prerequisites

Install the following on your machine:

  1. Node.js (comes with npm)
  2. PostgreSQL

Set up PostgreSQL

View thedocumentation for creating a user and database.

Configure environment variables

Make a copy of the.env.example file, replacingexample with the name of yourNODE_ENV e.g..env.local or.env.development.

When you're ready, declare the environment name with:

Linux/Mac

$ export NODE_ENV=local

Windows

Cmd

$ set NODE_ENV=local

PowerShell

$env:NODE_ENV="local"

How to populate the .env file

  1. PORT is the port that the Node/Express API server will run on,defaults to 8080. You can use any TCP/UDP port (0-65535) that is unused by another service e.g. Postgres on 5432.
  2. DB_USERNAME andDB_PASSWORD is the username/password combo for the Postgres user you created (see documentation above for assistance).
  3. DB_NAME is the name of the Postgres database you created.
  4. DB_PORT andDB_HOST are the Postgres defaults,5432 andlocalhost, respectively.
  5. EMAIL_HOST andEMAIL_PORT are the SMTP details for your email provider e.g.smtp.gmail.com and587, respectively, for Gmail.
  6. EMAIL_USERNAME andEMAIL_PASSWORD are your actual email credentials. We use the SMTP server to send email notifications about things like checkout errors or completions.
  7. CARD_NUMBER,NAME_ON_CARD,EXPIRATION_MONTH,EXPIRATION_YEAR, andSECURITY_CODE are your actual credit/debit card details.
  8. API_KEY_2CAPTCHA is your API key provided by2Captcha if you so desire to use their service. This can be left blank if not.

Optional: Configure credit cards

The.env file that you configure is set up for a single credit card.

However, if you want to specify multiple credit cards, populatecredit-cards.js using the example fromcredit-cards-example.js.

If you prefer not to use this method, you can simply leave this JS file as-is.

When starting a task, you can optionally specify the card you want to use via itsfriendlyName, otherwise the card from the.env file will be used.

Install the dependencies

$ npm install

Run the DB migrations

You may need to includenpx at the start of the commands

$ knex migrate:latest

Run the DB seeders

$ knex seed:run

Start the server

Tasks run parallelly usingpuppeteer-cluster.

Before starting up the server, define the number of concurrent tasks you plan to run:

$ export PARALLEL_TASKS=5

If you do not define this variable, it will default to1.

You can of course run more tasks, but they will be queued to run in a first-in, first-out (FIFO) manner.

Keep in mind that tasks that do not result incheckoutComplete will remain idle (not terminate) so that you can open the browser and view the error(s).

If a task encounters a captcha that must be manually solved, it will also remain idle and await completion.

Each task uses its own browser, so it's also important to keep in mind the CPU constraints of your machine.

When you're ready, start the server with:

$ npm start

Optional: Using Docker / Docker Compose

This may be particularly useful for Linux users who have reported issues with Puppeteer and Chromium.

You will need to haveDocker Compose and/orDocker installed to use this.

You will also need to make a copy of the.env.example file, replacingexample with the name of yourNODE_ENV e.g.docker.

A Docker image is available for the server codehere. You can also build it yourself by running the following in the root directory:

$ docker build -t sneakerbot .

Then run it and specify the env file with:

docker run -p 5900:5900 -p 8000:8000 --env NODE_ENV=docker --env-file .env.docker sneakerbot (replace8000 with whateverPORT you specified in.env.docker)

This Docker image is built fromnode:12 and usesxvfb withx11vnc to provide access to a GUI.

You can usevncviewer to connect to the VNC server running in the container.

You may also opt to run Postgres via Docker, in which case you can make use of thedocker-compose.yml file. Simply run the following in the root directory:

$ docker-compose build

$ docker-compose up

API

This bot exposes a Node/Express API server for managing addresses, proxies, and tasks. I would eventually like to see a UI, which integrates these APIs, built.

For each API, view the docs and try the requests in Postman.

  • Addresses - this is how you can pre-store billing and shipping addresses applied to tasks, and more specifically used at checkout time.
  • Proxies - this is how you can pre-store proxies that the bot will use when launching a task. Proxies are rotated so that they are never reused. In the future, this bot may include an integration with a proxy service likeBright Data (formerly Luminati).
  • Tasks - this is how you can pre-store, and then start checkout tasks.

UPDATE (as of 05/30/2021)

You can now specify aproduct_code on tasks. You will still need to provide theurl e.g.https://nike.com but can also provide aproduct_code e.g. "DA3130-100".

If aproduct_code is specified, the bot will iteratively search the desired site until there is a search result, click it, and then proceed as usual.

This will work with thenike.com,footsites, anddemandware sites.

If using with adidas.com, be sure to include the full site path e.g.https://www.adidas.com/us.

Feel free to check the newexample "with product code" under the POST /tasks API.

UPDATE (as of 06/24/2021)

You can now specify aWEBHOOK_ENDPOINT in your.env file for receiving webhook events (over HTTP/HTTPS) about task status.

When a task is done processing, aPOST request will be sent to the supplied URL with the following data:

{    taskId: integer,    checkoutComplete: true/false,    message: Some text about the task status, the same message is sent via email}

Starting a Task

You may start a task viaPOST /v1/tasks/:id/start or use thestart-task.js script like:

$ TASK_ID=<TASK_ID> CARD_FRIENDLY_NAME=<CARD_FRIENDLY_NAME> node ./scripts/start-task.js

Stopping a Task

You may stop a task that has run too long viaPOST /v1/tasks/:id/stop

Captcha Solving

This bot enables manual and automatic (via2Captcha) solving of captchas.

When creating a task, you can specifyauto_solve_captcha (Boolean), however, this parameter is optional and defaults totrue.

You must sign up for and fund a 2Captcha account, and then add yourAPI_KEY_2CAPTCHA to the .env file in order to auto-solve captchas.

For manually-solving captchas, you will be given a 5-minute timeout after the email notification to check the browser and solve the captcha.

Motivation

As a teenager, I operated sneakerbots.us, where I sold sneakerbots like this in addition to early links and ATC services.

Fastforward several years, I decided to upgrade this all-in-one bot from Java + Selenium to Node.js + Puppeteer, which I enjoy more for bot projects.

I am open sourcing this repo now, since I no longer operate the business, but also because I am of the opinion that this software can rival many of its commercial competitors.

Feel free to open a Pull Request to contribute to this project and help make it better! I will continue to support more websites and add more features as I can.

Also feel free to open an Issue or contact me via Telegram @samc621 if you have any trouble.

If you appreciate this, considerbuying me a coffee.

About

All-in-one bot, with auto captcha-solving and proxy management, using Node.js and Puppeteer.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp