Sneaker Bot (Python and Selenium) - 4/5/2020
Having been an avid sneaker collector since high school, I've always had an eye open to combining my technical knowledge with my love for sneakers. In the sneaker community it has become very commonplace to use "bots" to purchase the latest sneaker releases, since time and repetitive attempts are key to being able to get a pair. Back in high school had written a simple Javascript program to automate a few button clicks through a Chrome browser extension, but now that my coding experience and knowledge has increased, I thought I would take a crack at making a fully encapsulated desktop program.
I chose to use Python as the primary language for this project as I haven't built a GUI before in Python and I thought that would be a good exercise. I was able to find the popular automated web testing framework Selenium. Selenium Webdriver gives the ability to control a browser window through code, such as window locations, button clicks, and more. It is a very straightforward package to install and use, as well as having a popular community with good resources. I built the GUI using elements from PyQt, a Python binding of the popular cross-platform toolkit Qt. This gave me easy access to pre-built elements like buttons, text field, and more, which I was able to access as objects through my code.
Current Features
- The list of URLs, sizes selected, and proxy info can be saved to a custom ".hcp" format file allowing for import and export.
- Preview images of the selected sneaker.
- Notification if a specified size is out of stock.
- Circumvention of basic automated access detection.
- An API call to my webserver to run a check on a verification code to use the program.
- Proxy support, as IP based bans are possible if a website is able to detect you are using a bot.
- Implementation of multi-threading in order to allow multiple bot instances to run at once.
- Threads are able to be terminated by the user using flags between functions.
- Any cart instance is able to be open and checked out by the user through transferring cookies between browser sessions.
Wrap Up
The current version of the "HolyCopBot (hcp)" is available on my Github at this page, with future revisions planned!