├── orders └── orders.txt ├── requirements.txt ├── bin ├── chromedriver └── chromedriver.exe ├── billing.json ├── proxies.txt ├── gmail.json ├── README.md ├── LICENSE ├── main.py └── supreme.py /orders/orders.txt: -------------------------------------------------------------------------------- 1 | Screenshot of your orders will be saved here. -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.20.0 2 | selenium==3.11.0 3 | -------------------------------------------------------------------------------- /bin/chromedriver: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ed-biz23/Supreme-Bot/HEAD/bin/chromedriver -------------------------------------------------------------------------------- /bin/chromedriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ed-biz23/Supreme-Bot/HEAD/bin/chromedriver.exe -------------------------------------------------------------------------------- /billing.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "email": "", 4 | "tel": "", 5 | "address1": "", 6 | "address2": "", 7 | "zip": "", 8 | "city": "", 9 | "state": "", 10 | "ccNum": "", 11 | "expMon": "", 12 | "expYear": "", 13 | "ccCVV": "" 14 | } 15 | -------------------------------------------------------------------------------- /proxies.txt: -------------------------------------------------------------------------------- 1 | ip:port <<= if ip authenticated 2 | http://username:password@ip:port <<= if username/password authentication 3 | 4 | **must enter each ip:port or http://username:password@ip:port in a new line** 5 | **If not using any proxies please leave this txt file blank** 6 | -------------------------------------------------------------------------------- /gmail.json: -------------------------------------------------------------------------------- 1 | **Use EditThisCookie google chrome extension to import your Gmail cookies here.** 2 | 3 | **Step** 4 | - Go to your Gmail chrome window (make sure you're logged in) 5 | - Click on EditThisCookie extension, then click on export cookies. 6 | - Paste the cookies here and save it. 7 | 8 | **Make sure you use old Gmail account, so you won't have to solve captcha or else this bot will not be able to checkout out, and therefore you will have to checkout manually** 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Supreme-Bot 2 | OUTDATED 3 | 4 | Simple Supreme Bot, made with combination of requests and selenium. 5 |
Before you run, make sure you configure main.py, billing.json, and gmail.json
12 | 13 | Disclaimer: This script is not affiliated with Supreme New York brand, therefore please use it at your own risk. Also, things could go wrong and it may buy the wrong item; in that case I will not be held responsbile for it. So, please try it out with fake credit card and billing information before running the script for upcoming release or restock. 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Edward Biz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from supreme import Supreme 2 | import datetime 3 | 4 | def main(category, name, color, size, checkoutDelay, url): 5 | if releaseType == 'R': 6 | supreme = Supreme(category, name, color, size, checkoutDelay) 7 | supreme.addToCart(supreme.restock(url)) 8 | supreme.checkOut() 9 | else: 10 | supreme = Supreme(category, name, color, size, checkoutDelay) 11 | supreme.addToCart(supreme.search()) 12 | supreme.checkOut() 13 | 14 | if __name__ == '__main__': 15 | # Enter R for restock mode else leave blank 16 | releaseType = 'r'.upper() 17 | # Enter category for release mode else leave blank 18 | category = 'jackets' 19 | # Enter name for release mode else leave blank 20 | name = 'parka' 21 | # Enter color for release mode else leave blank 22 | color = 'rose' 23 | # Enter size for desired size else leave blank for O/S or random 24 | size = '' 25 | # Enter checkout delay to avoid ghost checkout or else enter None 26 | checkoutDelay = None 27 | 28 | # This will be prompt if restock mode is selected else ignore this 29 | url = input('Enter url: ').strip() if releaseType == 'R' else None 30 | 31 | # Don't make any changes here 32 | print(datetime.datetime.now().strftime('%x %X'), 'Starting the script') 33 | main(category, name, color, size, checkoutDelay, url) 34 | -------------------------------------------------------------------------------- /supreme.py: -------------------------------------------------------------------------------- 1 | import platform 2 | import sys 3 | import requests 4 | import json 5 | import random 6 | import datetime 7 | import time 8 | from lxml import etree 9 | from concurrent import futures as cf 10 | from selenium import webdriver 11 | from selenium.webdriver.support.ui import WebDriverWait 12 | from selenium.webdriver.common.by import By 13 | from selenium.webdriver.support import expected_conditions as EC 14 | from selenium.webdriver.support.ui import Select 15 | 16 | class Supreme(object): 17 | 18 | def __init__(self, category, name, color, size, delay): 19 | self.headers = {'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202'} 20 | self.proxies = [line.rstrip('\n') for line in open('proxies.txt', 'r')] 21 | self.urls = [] 22 | 23 | self.category = category.lower() if category else None 24 | self.prodName = name.lower() if name else None 25 | self.color = color.lower() if color else None 26 | self.size = size[0].upper() + size[1:].lower() if size else None 27 | self.delay = delay if delay else 0 28 | 29 | options = webdriver.ChromeOptions() 30 | options.add_argument('disable-infobars') 31 | options.add_argument('--disable-extensions') 32 | # options.add_argument('--headless') 33 | options.add_argument('--disable-gpu') 34 | options.add_argument('--no-sandbox') 35 | 36 | if platform.system() == 'Darwin': 37 | self.driver = webdriver.Chrome('./bin/chromedriver', chrome_options=options) 38 | else: 39 | self.driver = webdriver.Chrome('./bin/chromedriver.exe', chrome_options=options) 40 | self.driver.set_window_size(0,0) 41 | self.driver.get('http://www.supremenewyork.com/shop/all') 42 | for cookie in json.load(open('gmail.json')): 43 | self.driver.add_cookie(cookie) 44 | self.wait = WebDriverWait(self.driver, 10) 45 | 46 | with open('billing.json') as billing_json: 47 | billing = json.load(billing_json) 48 | self.name = billing['name'] 49 | self.email = billing['email'] 50 | self.tel = billing['tel'] 51 | self.address1 = billing['address1'] 52 | self.address2 = billing['address2'] 53 | self.zip = billing['zip'] 54 | self.city = billing['city'] 55 | self.state = billing['state'] 56 | self.ccNum = billing['ccNum'] 57 | self.expMon = billing['expMon'] 58 | self.expYear = billing['expYear'] 59 | self.ccCVV = billing['ccCVV'] 60 | 61 | def search(self): 62 | def checkMatch(url): 63 | try: 64 | r = requests.get(url, headers=self.headers, proxies={'http': random.choice(self.proxies)} if self.proxies else None) 65 | tree = etree.HTML(r.content) 66 | return tree.xpath('/html/head/title')[0].text, url 67 | except Exception as e: 68 | print(e) 69 | return None 70 | 71 | while True: 72 | try: 73 | print(datetime.datetime.now().strftime('%x %X'), 'Searching') 74 | r = requests.get('http://www.supremenewyork.com/shop/all/{}'.format(self.category), headers=self.headers, 75 | proxies={'http': random.choice(self.proxies)} if self.proxies else None) 76 | tree = etree.HTML(r.content) 77 | if not self.urls: 78 | for products in tree.xpath('//*[@id="container"]/article/div/a'): 79 | self.urls.append('http://www.supremenewyork.com'+products.get('href')) 80 | print(self.urls) 81 | else: 82 | with cf.ThreadPoolExecutor() as pool: 83 | futures = [] 84 | for products in tree.xpath('//*[@id="container"]/article/div/a'): 85 | if 'http://www.supremenewyork.com'+products.get('href') not in self.urls: 86 | futures.append(pool.submit(checkMatch, 'http://www.supremenewyork.com'+products.get('href'))) 87 | if futures: 88 | for x in futures: 89 | if x.result(): 90 | if self.prodName in x.result()[0].lower() and self.color in x.result()[0].lower(): 91 | return x.result()[1] 92 | time.sleep(0.5) 93 | except Exception as e: 94 | print(e) 95 | 96 | def restock(self, url): 97 | while True: 98 | try: 99 | print(datetime.datetime.now().strftime('%x %X'), 'Waiting for restock') 100 | r = requests.get(url, headers=self.headers, proxies={'http': random.choice(self.proxies)} if self.proxies else None) 101 | tree = etree.HTML(r.content) 102 | if tree.xpath('//*[@id="add-remove-buttons"]/input'): 103 | avlSz = [sizes for sizes in tree.xpath('//*[@id="s"]/option/text()')] if tree.xpath('//*[@id="s"]/option/text()') else ['N/A'] 104 | if avlSz: 105 | return url 106 | time.sleep(0.5) 107 | except Exception as e: 108 | print(e) 109 | 110 | def addToCart(self, url): 111 | self.driver.maximize_window() 112 | print(datetime.datetime.now().strftime('%x %X'), 'Adding to cart') 113 | try: 114 | self.driver.get(url) 115 | self.wait.until(EC.presence_of_element_located((By.CLASS_NAME, 'button'))) 116 | try: 117 | select = Select(self.driver.find_element_by_xpath('//*[@id="s"]')) 118 | select.select_by_visible_text(self.size) 119 | except: 120 | pass 121 | self.driver.find_element_by_name('commit').click() 122 | self.wait.until(EC.presence_of_element_located((By.CLASS_NAME, 'subtotal-container'))) 123 | print(datetime.datetime.now().strftime('%x %X'), 'Finish adding to cart') 124 | time.sleep(0.1) 125 | except Exception as e: 126 | print(e) 127 | self.driver.quit() 128 | sys.exit(1) 129 | 130 | def checkOut(self): 131 | print(datetime.datetime.now().strftime('%x %X'), 'Beginning checkout') 132 | try: 133 | self.driver.get('https://www.supremenewyork.com/checkout') 134 | self.driver.find_element_by_name('order[billing_name]').send_keys(self.name) 135 | self.driver.find_element_by_name('order[email]').send_keys(self.email) 136 | self.driver.find_element_by_name('order[tel]').click() 137 | for i in self.tel: 138 | self.driver.find_element_by_name('order[tel]').send_keys(i) 139 | self.driver.find_element_by_name('order[billing_address]').send_keys(self.address1) 140 | self.driver.find_element_by_name('order[billing_address_2]').send_keys(self.address2) 141 | self.driver.find_element_by_name('order[billing_zip]').send_keys(self.zip) 142 | try: 143 | self.driver.find_element_by_name('credit_card[nlb]').click() 144 | for i in self.ccNum: 145 | self.driver.find_element_by_name('credit_card[nlb]').send_keys(i) 146 | except: 147 | self.driver.find_element_by_id('cnb').click() 148 | for i in self.ccNum: 149 | self.driver.find_element_by_name('credit_card[cnb]').send_keys(i) 150 | self.driver.find_element_by_xpath('//*[@id="credit_card_month"]').send_keys(self.expMon) 151 | self.driver.find_element_by_xpath('//*[@id="credit_card_year"]').send_keys(self.expYear) 152 | try: 153 | self.driver.find_element_by_name('credit_card[rvv]').click() 154 | self.driver.find_element_by_name('credit_card[rvv]').send_keys(self.ccCVV) 155 | except: 156 | self.driver.find_element_by_name('credit_card[vval]').click() 157 | self.driver.find_element_by_name('credit_card[vval]').send_keys(self.ccCVV) 158 | self.driver.find_element_by_xpath('//*[@id="cart-cc"]/fieldset/p[2]/label').click() 159 | time.sleep(self.delay) 160 | self.driver.find_element_by_name('commit').send_keys('\n') # Remove hashtag for complete auto checkout 161 | print(datetime.datetime.now().strftime('%x %X'), 'Done submitting billing info, check email for order confirmation') 162 | try: 163 | self.wait.until(EC.visibility_of_any_elements_located((By.ID, 'confirmation'))) 164 | print(datetime.datetime.now().strftime('%x %X'), '\n' + self.driver.find_element_by_id('confirmation').text) 165 | except: 166 | pass 167 | screenShot = datetime.datetime.now().strftime('%x_%X').replace(':', '-').replace('/', '-') 168 | self.driver.save_screenshot('./orders/order_{}.png'.format(screenShot)) 169 | self.driver.quit() 170 | except Exception as e: 171 | print(e) 172 | self.driver.quit() 173 | sys.exit(1) 174 | --------------------------------------------------------------------------------