├── requirements.txt ├── resources ├── flags.gif ├── new_logo1.gif ├── python_shell.gif ├── python_shell1.gif ├── recaptcha-alert.wav ├── server_running.gif ├── allow_permissions.gif └── dramatic-sound-effect.wav ├── LICENSE ├── capcha_server.py ├── .gitignore ├── README.md └── free-amazon-bot.js /requirements.txt: -------------------------------------------------------------------------------- 1 | amazoncaptcha 2 | flask 3 | gunicorn -------------------------------------------------------------------------------- /resources/flags.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kkapuria3/FREE-Amazon-BUY-Bot/HEAD/resources/flags.gif -------------------------------------------------------------------------------- /resources/new_logo1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kkapuria3/FREE-Amazon-BUY-Bot/HEAD/resources/new_logo1.gif -------------------------------------------------------------------------------- /resources/python_shell.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kkapuria3/FREE-Amazon-BUY-Bot/HEAD/resources/python_shell.gif -------------------------------------------------------------------------------- /resources/python_shell1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kkapuria3/FREE-Amazon-BUY-Bot/HEAD/resources/python_shell1.gif -------------------------------------------------------------------------------- /resources/recaptcha-alert.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kkapuria3/FREE-Amazon-BUY-Bot/HEAD/resources/recaptcha-alert.wav -------------------------------------------------------------------------------- /resources/server_running.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kkapuria3/FREE-Amazon-BUY-Bot/HEAD/resources/server_running.gif -------------------------------------------------------------------------------- /resources/allow_permissions.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kkapuria3/FREE-Amazon-BUY-Bot/HEAD/resources/allow_permissions.gif -------------------------------------------------------------------------------- /resources/dramatic-sound-effect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kkapuria3/FREE-Amazon-BUY-Bot/HEAD/resources/dramatic-sound-effect.wav -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Karan Kapuria 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 | -------------------------------------------------------------------------------- /capcha_server.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import time 3 | from flask import Flask 4 | from amazoncaptcha import AmazonCaptcha 5 | 6 | ''' 7 | ------------------------------------------------------------------------ 8 | LOGGING - Initite logging for the Bot 9 | ------------------------------------------------------------------------ 10 | ''' 11 | logging.basicConfig(level=logging.INFO, format='[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s') 12 | logger = logging.getLogger(__name__) 13 | 14 | 15 | app = Flask(__name__) 16 | 17 | @app.route("/url//" , methods = [ 'POST']) 18 | def link( token, link_jpg): 19 | logger.info(f"Captcha JPEG File: {link_jpg}") 20 | logger.info(f"Captcha Token: {token}") 21 | link_url = 'https://images-na.ssl-images-amazon.com/captcha/',token ,'/' , link_jpg 22 | link_url = ''.join(link_url) 23 | full_jpg = link_url , link_jpg 24 | full_jpg = ''.join(full_jpg) 25 | captcha = AmazonCaptcha.fromlink(full_jpg) 26 | solution = captcha.solve() 27 | logger.info(f"Solution : {solution}") 28 | return solution 29 | 30 | @app.route("/" , methods = [ 'GET']) 31 | def ready(): 32 | 33 | logger.info(f"Server is listening ..") 34 | return "\n
\n

STATUS: Amazon Captcha Sever is running !


\n

If you hear a sound when you refresh and your terminal looks like below.



You are all set !! You can close this tab. \n" 35 | 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | * Update: ***This Repository is no longer maintined. A completely new REST based tool for this is under development (August 2023)*** 2 |
3 | 4 | 5 | [![Discord](https://img.shields.io/discord/863863008329596968?color=%237289da%20&label=FOR%20SUPPORT%20AND%20FAQs%20%20%7C%20JOIN%20DISCORD&style=for-the-badge)](https://discord.gg/wkznBbgBFD) 6 | 7 | ``` 8 | 9 | Please star my repo if this contribution helped you ! Its FREEE ! 10 | 11 | Please Join Support & FAQ Discord if you have questions. 12 | 13 | ``` 14 | # FREE Amazon Buy Bot — Open Source GPU/PS5/Xbox Bot 15 | 16 | ## Description 17 | 18 | FREE Amazon Buy Bot is an Add to Cart and Auto Checkout Bot. This auto buying bot can search **multiple** item repeatedly on the item page using `AMAZON_PRODUCT_ID`. Once the desired item is available it can add to cart and checkout very fast. This auto purchasing Bot works on browsers so it can run in all Operating Systems. It can run for multiple items simultaneously. It can bypass Amazon Captcha. 19 | 20 | "Running a bot can increase your success chances only ; but does not guarantee that you will successfully cart each time. If you do not agree, then please do not use this code." 21 | 22 | ## Getting Started 23 | 24 | 1. Create a [github](https://github.com/login?return_to=%2Fkkapuria3) account. It always helps ! 25 | 2. Star this repository. Its FREE ! 26 | 3. Please follow me here if you like my contribution: [](https://github.com/kkapuria3) 27 | 28 | ### Dependencies 29 | 30 | #### 1. Browser Dependencies 31 | 32 | 1. Install [Tampermonkey Extention](https://www.tampermonkey.net/) 33 | 2. Amazon Account 34 | 3. Please allow [Pop-Ups](https://www.isc.upenn.edu/how-to/configuring-your-web-browser-allow-pop-windows) for ```https://www.amazon.com/``` in your browser 35 | 36 | #### 2. Local Dependencies 37 | 38 | 1. Python 3.7+ in a Terminal. Please use [WSL2](https://docs.microsoft.com/en-us/windows/wsl/about) to run python. `gunicorn` does not run on powershell or cmd. 39 | 40 | ### Installing 41 | 42 | #### 1. Browser Dependencies 43 | 44 | * Go to tampermonkey dashboard from broswer extension and create a new script 45 | * Delete all the contents and copy full code from [free-amazon-bot.js](https://raw.githubusercontent.com/kkapuria3/Amazon-Bot/main/free-amazon-bot.js) 46 | * Save the script 47 | 48 | #### 2. Local Dependencies 49 | * Clone this repository to a folder you like with command `git clone https://github.com/kkapuria3/Best-Amazon-Bot.git` 50 | * Navigate to location where you cloned this; using your favourite shell 51 | * Run `pip install -r requirements.txt` 52 | 53 | ### Running Bot 54 | 55 | 1. From your terminal, inside the cloned location run `gunicorn capcha_server:app`. It will look like this. 56 | 57 | 58 | 59 | 2. Go to [`http://localhost:8000/`](http://localhost:8000/) on your browser. And your browser will look like: 60 | 61 | 62 | 63 | 3. Now go to our TamperMonkey script and Add the 10 digit Amazon item code in `AMAZON_PRODUCT_ID` array and respective cut-off price in `CUTOFF_ARRAY` 64 | 65 | 66 | 67 | 4. You are all set. Now navigate to your item page and you should see the bot work. 68 | 69 | 5. When you get captcha for first time you will get this prompt. You can click `Always Allow` or `Allow Once (might have to press everytime)` 70 | 71 | 72 | 73 | ### Where to go from here / still not working ? 74 | 75 | * Join our discord community [here](https://discord.gg/UcxcyxS5X8) 76 | * Ask in #general-help channel if you have problems setting up. 77 | * Drops alerts on our [discord](https://discord.gg/UcxcyxS5X8) are forwarded from multiple third-party telegrams. 78 | 79 | ## Authors 80 | 81 | * [Karan Kapuria](https://kkapuria3.github.io/) 82 | 83 | Buy Me A Coffee 84 | 85 | 86 | ## Version History and Changelog 87 | 88 | * 1.0-beta - Runs only Testmode. 89 | * - Code is not complete commented. 90 | * - No support for Amazon Captcha (Soft Ban) - Future support with local flask server 91 | * - Dog Pages are not handled 92 | * 1.1-beta - Fixed Sellers Loop 93 | * - When in Sellers, Used items are not checked for 94 | * - Still No support for Amazon Captcha (Soft Ban) & Dog Pages 95 | * - More code commented 96 | * 2.0 - Fully Functional Bot with Local Gunicorn Server 97 | * - Using flask, gunicorn and amazoncapcha; we solve Amazon Captcha (Soft Ban) 98 | * - No autocheckout yet. *Will be released as minor update later.* 99 | * - Faster page reload on seller pages (4 Seconds) 100 | * - When cart is disabled with Dog Pages, it will refresh cart every 10 second 101 | * - When resellers are disabled, bot will show 0 items and refresh 102 | * - More code commented 103 | 104 | 105 | ## License 106 | 107 | This project is licensed under the MIT License - see the LICENSE.md file for details 108 | -------------------------------------------------------------------------------- /free-amazon-bot.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Amazon-RefreshNoBot 3 | // @include https://www.amazon.com/* 4 | // @include http://localhost:800* 5 | // @version v2.0 6 | // @description This aint bot, its RefreshNoBot 7 | // @author Karan Kapuria 8 | // @grant window.close 9 | // @grant GM_setValue 10 | // @grant GM_getValue 11 | // @grant GM_xmlhttpRequest 12 | 13 | // Version Changelog 14 | // 1.0-beta - Runs only Testmode. 15 | // - Code is not complete commented. 16 | // - No support for Amazon Captcha (Soft Ban) - Future support with local flask server 17 | // - Dog Pages are not handled 18 | // 1.1-beta - Fixed Sellers Loop 19 | // - When in Sellers, Used items are not checked for 20 | // - Still No support for Amazon Captcha (Soft Ban) & Dog Pages 21 | // - More code commented 22 | // 2.0 - Fully Functional Bot with Local Gunicorn Server 23 | // - Using flask, gunicorn and amazoncapcha; we solve Amazon Captcha (Soft Ban) 24 | // - Faster page reload on seller pages (4 Seconds) 25 | // - When cart is disabled with Dog Pages, it will refresh cart every 10 second 26 | // - When resellers are disabled, bot will show 0 items and refresh 27 | // - No autocheckout yet. Will be released as minor update later. 28 | // - More code commented 29 | 30 | // ==/UserScript== 31 | 32 | 33 | /* 34 | 35 | 36 | █████╗ ███╗ ███╗ █████╗ ███████╗ ██████╗ ███╗ ██╗ ██████╗ ██████╗ ████████╗ 37 | ██╔══██╗████╗ ████║██╔══██╗╚══███╔╝██╔═══██╗████╗ ██║ ██╔══██╗██╔═══██╗╚══██╔══╝ 38 | ███████║██╔████╔██║███████║ ███╔╝ ██║ ██║██╔██╗ ██║ ██████╔╝██║ ██║ ██║ 39 | ██╔══██║██║╚██╔╝██║██╔══██║ ███╔╝ ██║ ██║██║╚██╗██║ ██╔══██╗██║ ██║ ██║ 40 | ██║ ██║██║ ╚═╝ ██║██║ ██║███████╗╚██████╔╝██║ ╚████║ ██████╔╝╚██████╔╝ ██║ 41 | ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═╝ 42 | 43 | “Make it work, make it right, make it fast.” – Kent Beck 44 | 45 | */ 46 | "use strict"; 47 | //________________________________________________________________________ 48 | 49 | // CONSTANTS 50 | // [ Do not add/remove quotation marks when updating] 51 | //________________________________________________________________________ 52 | 53 | //____ REQUIRED FLAGS : AMAZON ID & PRICE CUTOFF _________________________ 54 | 55 | 56 | let PRODUCT_ARRAY = ["B08WM28PVH", "B096YM573B", "B096WM6JFS", "B096YMW2FS", "B09B1DGRH4"]; 57 | const CUTOFF_ARRAY = [500, 500, 500, 500, 500]; // No quotes 58 | 59 | //____ REQUIRED FLAGS : TESTMODE OR BUY MODE _____________________________ 60 | 61 | const TESTMODE = "Yes" // This flag is unused. Will be implemented in next release 62 | 63 | 64 | //________________________________________________________________________ 65 | 66 | // MAIN CODE : DO NOT CHANGE 67 | //________________________________________________________________________ 68 | 69 | const PRODUCT_URL = document.URL 70 | 71 | const delay = ms => new Promise(res => setTimeout(res, ms)); 72 | const NUMERIC_REGEXP = /[-]{0,1}[\d]*[.]{0,1}[\d]+/g; 73 | 74 | const RETRY_COUNT = 1 75 | 76 | //________________________________________________________________________ 77 | 78 | // MAIN CODE : CAPTCHA PAGES 79 | //________________________________________________________________________ 80 | 81 | if (document.getElementsByClassName("a-box a-alert a-alert-info a-spacing-base").length > 0) { 82 | 83 | console.log(document.getElementsByClassName("a-box a-alert a-alert-info a-spacing-base")) 84 | console.log('CAPCTHA PAGE') 85 | 86 | var Oh_No_Its_Some_Captcha = new Audio("https://github.com/kkapuria3/BestBuy-GPU-Bot/blob/dev-v2.5-mem_leak_fix/resources/alert.mp3?raw=true"); 87 | Oh_No_Its_Some_Captcha.play() 88 | 89 | //"\n\n 90 | 91 | var IMAGE_URL = document.getElementsByClassName("a-row a-text-center")[1].innerHTML.split('captcha/')[1] 92 | var FIRST_ELEMENT = IMAGE_URL.split('/')[0] 93 | var SECOND_ELEMENT_Raw = IMAGE_URL.split('/')[1] 94 | var SECOND_ELEMENT = SECOND_ELEMENT_Raw.split('">')[0] 95 | console.log(SECOND_ELEMENT) 96 | 97 | const CAPTCHA_URL = 'http://localhost:8000/url/' + FIRST_ELEMENT + '/' + SECOND_ELEMENT 98 | console.log(CAPTCHA_URL) 99 | GM_xmlhttpRequest({ 100 | method: "POST", 101 | url: CAPTCHA_URL, 102 | onload: function(response) { 103 | 104 | console.log(response.response); 105 | GM_setValue(CAPTCHA_URL, response.response); 106 | 107 | 108 | } 109 | }) 110 | 111 | 112 | setTimeout(function() { 113 | 114 | const SOLUTION = GM_getValue(CAPTCHA_URL); 115 | document.getElementById("captchacharacters").value = SOLUTION 116 | document.getElementsByClassName('a-button-text')[0].click() 117 | 118 | }, 9000) 119 | 120 | 121 | 122 | 123 | } 124 | 125 | //________________________________________________________________________ 126 | 127 | // MAIN CODE : ITEM PAGE OPERATIONS 128 | //________________________________________________________________________ 129 | 130 | for (let i = 0; i < PRODUCT_ARRAY.length; i++) { 131 | 132 | const AMAZON_PRODUCT_ID = PRODUCT_ARRAY[i] 133 | const CUTOFF_PRICE = CUTOFF_ARRAY[i] 134 | 135 | //____ BLACK ELEMENT : ______ 136 | 137 | function createFloatingBadge(mode, status, ht = 160) { 138 | const iconUrl = "https://kkapuria3.github.io/images/KK.png"; 139 | const iconUrl1 = "https://i.pinimg.com/600x315/cd/28/16/cd28168e19f7fdf9c666edd083921129.jpg" 140 | const iconUrl2 = "https://brandlogovector.com/wp-content/uploads/2020/07/Discord-Logo-Icon-Small.png" 141 | const iconUrl3 = "https://img.icons8.com/cotton/2x/source-code.png" 142 | 143 | const script = document.createElement('script'); 144 | 145 | const $container = document.createElement("div"); 146 | const $bg = document.createElement("div"); 147 | 148 | const $link = document.createElement("a"); 149 | const $link1 = document.createElement("a"); 150 | const $link2 = document.createElement("a"); 151 | const $link3 = document.createElement("a"); 152 | 153 | const $img = document.createElement("img"); 154 | const $img1 = document.createElement("img"); 155 | const $img2 = document.createElement("img"); 156 | const $img3 = document.createElement("img"); 157 | 158 | const $text = document.createElement("P"); 159 | const $BAGDE_BORDER = document.createElement("P"); 160 | const $mode = document.createElement("P"); 161 | const $status1 = document.createElement("P"); 162 | 163 | script.setAttribute('type', 'text/javascript'); 164 | script.setAttribute('src', 'https://cdn.jsdelivr.net/npm/brython@3.9.5/brython.min.js'); 165 | 166 | $link.setAttribute("href", "https://github.com/kkapuria3"); 167 | $link.setAttribute("target", "_blank"); 168 | $link.setAttribute("title", "RefreshNoBot"); 169 | 170 | $link1.setAttribute("href", "https://www.buymeacoffee.com/kapuriakaran"); 171 | $link1.setAttribute("target", "_blank"); 172 | $link1.setAttribute("title", "Buy Dev a Coffee"); 173 | 174 | $link2.setAttribute("href", "https://discord.gg/UcxcyxS5X8"); 175 | $link2.setAttribute("target", "_blank"); 176 | $link2.setAttribute("title", "Join Discord"); 177 | 178 | $link3.setAttribute("href", "https://www.buymeacoffee.com/kapuriakaran"); 179 | $link3.setAttribute("target", "_blank"); 180 | $link3.setAttribute("title", "View Source Code"); 181 | 182 | $img.setAttribute("src", iconUrl); 183 | $img1.setAttribute("src", iconUrl1); 184 | $img2.setAttribute("src", iconUrl2); 185 | $img3.setAttribute("src", iconUrl3); 186 | var MAIN_TITLE = ("Open Source Amazon-Bot v2.0 ◻️ TESTMODE: " + TESTMODE + " ◻️ ITEM KEYWORD: " + AMAZON_PRODUCT_ID + " ◻️ CUTOFF PRICE : " + CUTOFF_PRICE); 187 | $BAGDE_BORDER.innerText = ("------------------------------------------------------------------------------------------------------------------------------------ "); 188 | $text.innerText = MAIN_TITLE; 189 | $mode.innerText = mode; 190 | $status1.innerText = status; 191 | 192 | $container.style.cssText = "position:fixed;left:0;bottom:0;width:950px;height:" + ht + "px;background: black; border: 1px solid #FFF"; 193 | $bg.style.cssText = "position:absolute;left:-100%;top:0;width:60px;height:350px;background:#1111;box-shadow: 0px 0 10px #060303; border: 1px solid #FFF;"; 194 | $link.style.cssText = "position:absolute;display:block;top:11px;left: 10px; z-index:10;width: 30px;height:30px;border-radius: 1px;overflow:hidden;"; 195 | $link1.style.cssText = "position:absolute;display:block;top:40px;left: 0px; z-index:10;width: 50px;height:50px;border-radius: 0px;overflow:hidden;"; 196 | $link2.style.cssText = "position:absolute;display:block;top:70px;left: 0px; z-index:10;width: 50px;height:50px;border-radius: 0px;overflow:hidden;"; 197 | $link3.style.cssText = "position:absolute;display:block;top:118px;left: 12px; z-index:10;width: 25px;height:25px;border-radius: 0px;overflow:hidden;"; 198 | $img.style.cssText = "display:block;width:100%"; 199 | $img1.style.cssText = "display:block;width:100%"; 200 | $img2.style.cssText = "display:block;width:100%"; 201 | $img3.style.cssText = "display:block;width:100%"; 202 | $text.style.cssText = "position:absolute;display:block;top:3px;left: 50px;background: transperant; color: white;"; 203 | $BAGDE_BORDER.style.cssText = "position:absolute;display:block;top:22px;left: 50px;background: transperant; color: green;"; 204 | $mode.style.cssText = "position:absolute;display:block;top:43px;left: 50px;background: transperant; color: white;"; 205 | $status1.style.cssText = "position:absolute;display:block;top:64px;left: 50px;background: transperant; color: white;"; 206 | // 207 | // 208 | $link.appendChild($img); 209 | $link1.appendChild($img1); 210 | $link2.appendChild($img2); 211 | $link3.appendChild($img3); 212 | $container.appendChild(script); 213 | $container.appendChild($bg); 214 | $container.appendChild($link); 215 | $container.appendChild($link1); 216 | $container.appendChild($link2); 217 | $container.appendChild($link3); 218 | $container.appendChild($text); 219 | $container.appendChild($BAGDE_BORDER); 220 | $container.appendChild($mode); 221 | $container.appendChild($status1) 222 | return $container; 223 | } 224 | 225 | //____ LOGIC : ______ 226 | 227 | // If your product URL has the AMAZON_PRODUCT_ID, we will run this logic. Simple. 228 | 229 | if (PRODUCT_URL.includes(AMAZON_PRODUCT_ID)) { 230 | //____ BADGE UPDATE : ______ 231 | var $badge = createFloatingBadge("Starting ..", "Init.."); 232 | document.body.appendChild($badge); 233 | $badge.style.transform = "translate(0, 0)" 234 | //____ DEBUG : ______ 235 | console.log('Detected Product ID: ' + AMAZON_PRODUCT_ID); 236 | console.log('Cutoff Price: ' + CUTOFF_PRICE); 237 | 238 | //____ Get Product Title : ______ 239 | var Product_Title = document.getElementsByClassName("a-size-large product-title-word-break"); 240 | console.log(Product_Title[0].innerHTML) 241 | 242 | // If URL contains 'aod_redir', means we are checking for Extra Sellers, we will try to parse extra sellers in here 243 | if (location.href.includes('aod_redir')) { 244 | //____ BADGE UPDATE : ______ 245 | const $badge = createFloatingBadge('Extra Seller Offers Fetched | Checking offers ..', "Add to cart if price is below CUTOFF_PRICE "); 246 | document.body.appendChild($badge); 247 | $badge.style.transform = "translate(0, 0)" 248 | const PRICES_BADGE = []; 249 | console.log('START CHECKING SELLERS NOW ..') 250 | //____ TIMEOUT : _____ 251 | setTimeout(function() { 252 | 253 | console.log('Open extra sellers') 254 | //console.log(New_Sellers) 255 | 256 | 257 | // We are directly parsing all the sellers ADD TO CART BUTTONS 258 | var Seller_Buttons = document.getElementsByClassName("a-button-input"); 259 | 260 | // We will loop over all the found buttons and then try to get ATC button where SELLER_PRICE is lower than CUTOFF_PRICE 261 | for (var i = 0; i < Seller_Buttons.length; i++) { 262 | 263 | // Getting Seller Button Data 264 | var SELLER_BUTTON_DATA = Seller_Buttons.item(i) 265 | 266 | // Getting Seller Price from Outter HTML of button 267 | var SELLER_PRICE = Seller_Buttons[i].outerHTML.match(NUMERIC_REGEXP).join('') 268 | //console.log(SELLER_PRICE) 269 | 270 | // If SELLER_PRICE is less than CUTOFF_PRICE and SELLER_PRICE is Greater than 0 (to eliminate pseudo buttons) 271 | if (SELLER_PRICE < CUTOFF_PRICE && SELLER_PRICE > 0) { 272 | 273 | const $badge = createFloatingBadge('PRICE MATCH FOUND..', SELLER_PRICE); 274 | document.body.appendChild($badge); 275 | 276 | 277 | setTimeout(function() { 278 | window.open("https://www.amazon.com/gp/cart/view.html", '_blank'); 279 | window.close() 280 | 281 | }, 2000) 282 | 283 | // BUY WILL BE TRIGGERED HERE 284 | console.log('LOW Price: ' + SELLER_PRICE + ' | ButtonID : ' + SELLER_BUTTON_DATA + ' | Button Number : ' + i + ' | Button TimeStamp' + Date.now() + '\n') 285 | Seller_Buttons[i].click(); 286 | 287 | 288 | // If SELLER_PRICE IS HIGHER than CUTOFF_PRICE | Print the details to badge and move forward 289 | } else if (SELLER_PRICE > CUTOFF_PRICE && SELLER_PRICE > 0 && SELLER_PRICE < (CUTOFF_PRICE + 2000)) { 290 | 291 | //refresh 292 | console.log('HIGH Price: ' + SELLER_PRICE + ' | ButtonID : ' + SELLER_BUTTON_DATA + ' | Button Number : ' + i + ' | Button TimeStamp' + Date.now() + '\n') 293 | //console.log('Price is High') 294 | var BADGE_SELLER_DETAILS = ' PRICE HIGHER | $:' + SELLER_PRICE + ' | BUTTON DATA : ' + SELLER_BUTTON_DATA + ' | BUTTON NUMBER : ' + i + ' | TIMESTAMP : ' + Date.now() + '◻️ ◻️ ◻️ ◻️ ◻️' 295 | PRICES_BADGE.push(BADGE_SELLER_DETAILS) 296 | 297 | 298 | } 299 | // Count Total Valid SELLER_BUTTON 300 | const TOTAL_ITEMS = 'Total Items : ' + PRICES_BADGE.length 301 | 302 | // Change hieght of badge based on total items retrieved 303 | 304 | if (i >= 11) { 305 | const $badge = createFloatingBadge(TOTAL_ITEMS, PRICES_BADGE, 330); 306 | document.body.appendChild($badge); 307 | $badge.style.transform = "translate(0, 0)" 308 | } else if (i > 6) { 309 | const $badge = createFloatingBadge(TOTAL_ITEMS, PRICES_BADGE, 250); 310 | document.body.appendChild($badge); 311 | $badge.style.transform = "translate(0, 0)" 312 | } else { 313 | const $badge = createFloatingBadge(TOTAL_ITEMS, PRICES_BADGE); 314 | document.body.appendChild($badge); 315 | $badge.style.transform = "translate(0, 0)" 316 | } 317 | 318 | 319 | } 320 | 321 | 322 | 323 | }, 4000) 324 | 325 | setTimeout(function() { 326 | location.href = "https://www.amazon.com/dp/" + AMAZON_PRODUCT_ID + "/" 327 | }, 6000) 328 | 329 | // MAIN PRODUCT PAGE OPERATIONS 330 | // If price exists in MAIN BUY BOX or NEW BUY BOX then check if its less than CUTOFF or else go to sellers page 331 | } else if (document.getElementById("price_inside_buybox") || document.getElementById("newBuyBoxPrice")) { 332 | 333 | if (document.getElementById("price_inside_buybox")) { 334 | var Title_Price = document.getElementById("price_inside_buybox").innerHTML; 335 | } 336 | if (document.getElementById("newBuyBoxPrice")) { 337 | Title_Price = document.getElementById("newBuyBoxPrice").innerHTML; 338 | } 339 | 340 | // Parse the Title Price 341 | Title_Price = Title_Price.match(NUMERIC_REGEXP).join('') 342 | 343 | //console.log(Title_Price) 344 | var Title_Price1 = 'Title Price : ' + Title_Price 345 | const $badge = createFloatingBadge(Title_Price1, 'We will check resellers now ...'); 346 | document.body.appendChild($badge); 347 | $badge.style.transform = "translate(0, 0)" 348 | 349 | 350 | if (Title_Price <= CUTOFF_PRICE) { 351 | 352 | console.log('Buy Trigger') 353 | document.getElementsByClassName("a-button-input attach-dss-atc")[0].click(); 354 | setTimeout(function() { 355 | var soundData = new Audio("https://github.com/kkapuria3/BestBuy-GPU-Bot/blob/dev-v2.5-mem_leak_fix/resources/alert.mp3?raw=true"); 356 | soundData.play() 357 | document.getElementsByClassName("a-button-input")[1].click(); 358 | 359 | }, 1000) 360 | 361 | 362 | } else { 363 | setTimeout(function() { 364 | window.open("https://www.amazon.com/gp/offer-listing/" + AMAZON_PRODUCT_ID + "/ref=dp_olp_unknown_mbc", '_blank'); 365 | window.close() 366 | 367 | }, 3000) 368 | } 369 | 370 | 371 | } else { 372 | 373 | const $badge = createFloatingBadge('Title Price Empty', "Lets check Resellers"); 374 | document.body.appendChild($badge); 375 | $badge.style.transform = "translate(0, 0)" 376 | setTimeout(function() { 377 | console.log('timeout1'); 378 | 379 | 380 | location.href = "https://www.amazon.com/gp/offer-listing/" + AMAZON_PRODUCT_ID + "/ref=dp_olp_unknown_mbc"; 381 | }, 3000) 382 | 383 | 384 | 385 | } 386 | 387 | 388 | if (document.getElementById("outOfStock") && document.getElementsByClassName("aod-message-component") == null) { 389 | 390 | const $badge = createFloatingBadge('Title Price Empty', "Refreshing..."); 391 | document.body.appendChild($badge); 392 | $badge.style.transform = "translate(0, 0)" 393 | setTimeout(function() { 394 | console.log('timeoutNull') 395 | 396 | setTimeout(function() { 397 | console.log('timeout2'); 398 | location.href = "https://www.amazon.com/gp/offer-listing/" + AMAZON_PRODUCT_ID + "/" 399 | }, 2000) 400 | 401 | var Message = document.getElementsByClassName("a-text-bold aod-no-offer-normal-font")[0].innerHTML; 402 | console.log(Message) 403 | 404 | const $badge = createFloatingBadge('Checking Resellers', Message); 405 | document.body.appendChild($badge); 406 | $badge.style.transform = "translate(0, 0)" 407 | 408 | 409 | 410 | 411 | }, 5000) 412 | 413 | 414 | } 415 | // When no title price is found 416 | if (document.getElementById("outOfStock") && document.getElementsByClassName("aod-message-component")) { 417 | 418 | const $badge = createFloatingBadge('Title Price Empty', "Refreshing..."); 419 | document.body.appendChild($badge); 420 | $badge.style.transform = "translate(0, 0)" 421 | setTimeout(function() { 422 | console.log('timeout1') 423 | 424 | var Message = document.getElementsByClassName("a-text-bold aod-no-offer-normal-font")[0].innerHTML; 425 | console.log(Message) 426 | 427 | const $badge = createFloatingBadge('Checking Resellers', Message); 428 | document.body.appendChild($badge); 429 | $badge.style.transform = "translate(0, 0)" 430 | 431 | 432 | 433 | }, 5000) 434 | 435 | 436 | } 437 | 438 | 439 | } 440 | 441 | 442 | } 443 | 444 | //________________________________________________________________________ 445 | 446 | // MAIN CODE : LOCAL HOST TESTING 447 | //________________________________________________________________________ 448 | 449 | // If on http://localhost:8000/, then play the sound and send test request. Check solution for test request in your terminal 450 | if (document.URL.includes('http://localhost:8000/')) { 451 | 452 | var DA_TA_DA = new Audio("https://github.com/kkapuria3/Best-Amazon-Bot/blob/dev-v2.0/resources/dramatic-sound-effect.wav?raw=true"); 453 | DA_TA_DA.play() 454 | 455 | 456 | GM_xmlhttpRequest({ 457 | method: "POST", 458 | url: "http://localhost:8000/url/dddfleoy/Captcha_lkdgslujsl.jpg", 459 | onload: function(response) { 460 | 461 | console.log(response.response); 462 | GM_setValue('TEST_RESPONSE', response.response); 463 | 464 | 465 | } 466 | }) 467 | } 468 | 469 | //________________________________________________________________________ 470 | 471 | // MAIN CODE : DOG PAGES 472 | //________________________________________________________________________ 473 | else if (document.getElementById('d').alt.includes('Dogs')) { 474 | 475 | console.log('Dogs of Amazon') 476 | setTimeout(function() { 477 | 478 | location.href = 'https://www.amazon.com/gp/cart/view.html' 479 | 480 | }, 10000) 481 | 482 | 483 | } 484 | //________________________________________________________________________ 485 | 486 | // MAIN CODE : FINAL CHECKOUT PAGE 487 | //________________________________________________________________________ 488 | // If Page is in Final Checkout Play the sound 489 | else if (document.URL.includes('/gp/buy/spc/handlers/')) { 490 | 491 | var soundData1 = new Audio("https://github.com/kkapuria3/BestBuy-GPU-Bot/blob/dev-v2.5-mem_leak_fix/resources/alert.mp3?raw=true"); 492 | soundData1.play() 493 | 494 | setTimeout(function() { 495 | 496 | 497 | }, 10000) 498 | 499 | 500 | } 501 | // On Cart Page, check if any item in cart. It can be any item. Page will redirect to Final Checkout. 502 | else if (document.URL.includes('/gp/cart/')) { 503 | 504 | setTimeout(function() { 505 | 506 | if (document.getElementsByClassName("a-size-medium a-color-base sc-price sc-white-space-nowrap").length > 0) { 507 | 508 | location.href = 'https://www.amazon.com/gp/buy/spc/handlers/display.html?hasWorkingJavascript=1' 509 | 510 | } else if (document.getElementById("g").innerHTML.includes('ref=cs_503_link') == true) { 511 | 512 | 513 | console.log('Amazon 503 Cart error. Lets try cart again in 5 seconds') 514 | setTimeout(function() { 515 | location.href = 'https://www.amazon.com/gp/cart/view.html' 516 | }, 5000) 517 | 518 | 519 | } else { 520 | 521 | console.log('Empty Cart') 522 | } 523 | 524 | }, 10000) 525 | 526 | 527 | } 528 | // On Pseudo Cart Page from Title Price ATC, check if any item in cart. It can be any item. Page will redirect to Final Checkout. 529 | else if (document.URL.includes('huc')) { 530 | console.log(document.URL) 531 | 532 | var soundData = new Audio("https://github.com/kkapuria3/BestBuy-GPU-Bot/blob/dev-v2.5-mem_leak_fix/resources/alert.mp3?raw=true"); 533 | soundData.play() 534 | 535 | setTimeout(function() { 536 | 537 | 538 | 539 | }, 3000) 540 | 541 | } --------------------------------------------------------------------------------