natewong1313 / bird-bot

A Nintendo Switch checkout bot. Currently supports Walmart and Best buy
MIT License
1.18k stars 336 forks source link

Best Buy Freeze Executing 'Adding To Cart' #31

Open jb05042 opened 4 years ago

jb05042 commented 4 years ago

When using the bot with macos on Best Buy's site I've noticed that it the execution will freeze after adding the item to the cart.

The documentation states either the item is not supported or the website is acting up. Is there a way to verify if an item is supported?

Bird Bot Freeze
5150Joker commented 3 years ago

Same here. I am new but used ByteDestroyer's fix to checkout a keyboard from BBY yesterday and it worked. Today when all the 3080's dropped it failed to checkout. It was then added to my cart but I was working so I didn't check out in time :(. Now they are all stuck in "Adding to cart"

Yep, I was happy when it added them to cart but then...nothing. Missed out, probably would've gotten one if I had just used the BB app + apple pay.

Rchimedes commented 3 years ago

Same here. I am new but used ByteDestroyer's fix to checkout a keyboard from BBY yesterday and it worked. Today when all the 3080's dropped it failed to checkout. It was then added to my cart but I was working so I didn't check out in time :(. Now they are all stuck in "Adding to cart"

Yep, I was happy when it added them to cart but then...nothing. Missed out, probably would've gotten one if I had just used the BB app + apple pay.

I tried that last time they were in stock and it glitched out when Apple Pay was processing. I forget if I was on the Newegg or BBY app but that's what happened. I am only trying to fight bots with bots so I can have one for myself. Not trying to scalp here.

5150Joker commented 3 years ago

Same here. I am new but used ByteDestroyer's fix to checkout a keyboard from BBY yesterday and it worked. Today when all the 3080's dropped it failed to checkout. It was then added to my cart but I was working so I didn't check out in time :(. Now they are all stuck in "Adding to cart"

Yep, I was happy when it added them to cart but then...nothing. Missed out, probably would've gotten one if I had just used the BB app + apple pay.

I tried that last time they were in stock and it glitched out when Apple Pay was processing. I forget if I was on the Newegg or BBY app but that's what happened. I am only trying to fight bots with bots so I can have one for myself. Not trying to scalp here.

Same here, been trying to get a card since release but no luck.

ByteDestroyer commented 3 years ago

I’d like to point out a few things related to the use of the bot. First, you should know how the bot works if you want to get the most out of it. As I said before, use my changes as a guideline and not as a final product. Second, BB implemented some measures to avoid the use of bots to buy Nvidia 3000 GPUs. I managed to get one today but it was manually as the bot failed me too, but I also used the bot as a notification tool in case the buying part failed. I learned two things during this checkout process. One is that they forced me to create a BB account to get the two free items that comes with the card, that part is not handled by the bot as the I didn’t saw that behavior before. Second, it forced me to use a code from my credit card provider to complete the purchase, even when I used that CC with the bot to complete previous purchases. This could be passed by the bot as the bot deals with this, complete purchase on browser setting, but it’s tricky and could fail, I never tested it. Hope this information can helps you guys.

Rchimedes commented 3 years ago

Yes it does and thanks for your insights. I think if I was paying attention I could have use it in the same way as you but I was distracted. Next time I suppose.

broncosmang commented 3 years ago

Was able to test purchase, but during the 3080 drop today I had a few instances where it said 'open browser' but when i clicked it would open and immediately shut close a browser window. anyone else have that issue?

parapraxis24 commented 3 years ago

Thanks to everyone that helped get this going, I'm indebted to all of you. Tested on a cheap flash drive on Best Buy and it worked. Had to do a few things to get it to work though. I'm running on Windows 10:

  1. Update files from #68
  2. Install geckodriver.exe into bird-bot folder
  3. Removed service_log_path="/dev/null", from both bestbuy.py AND utils.py (line 124)
  4. Installed Firefox (seems to rely on Firefox for some reason) @alim555 this fixed the same error I was getting.
  5. Got time-out issues, so I found an old line from the original bestbuy.py and added this between line 198 and 199:

198 while True: 199 self.status_signal.emit({"msg":"Checking Stock","status":"normal"}) 200 try:

I think that's all the errors I fixed to get this working. My problem now is when it adds to cart, it says it pulls a cookie from selenium, sits there for a minute, then proceeds to checkout and complete the order. If the item is OOS or Coming Soon, it won't pull any cookies. It does this every time, whether you stop or restart the task. In the bleeding-edge speed that we'll need to grab an item that will almost instantly sell out (ahem 3080), that extra minute it takes to pull that cookie is going to be the deciding factor between getting that item and not. Hopefully someone has a solution to this as well. Good luck all!

Thanks for posting this. I made the edits that @ByteDestroyer added to the repository, and added yours as well. I can confirm it worked on an in stock USB stick (although damn you 5.49 shipping on a 6.99 stick).

However, I'm stuck where you are with the 3080 cards. Bird-bot hangs up on checking stock and never moved forward with it.

Also, I have the discord webhook setup with my own server, but I didn't receive a notification about any status (successful or otherwise) but I suppose that's for a different ticket.

Thanks!

QualityQuestion commented 3 years ago

@Vic-in-a-Box my potential solution was to do the following -- which is very much a hack and I'm not sure the cookies will last long enough to make it worth it. But I was able to complete a test purchase without the delay doing this:

Add a line like this in the init function: self.cookies_from_browser = self.get_cookies_using_browser()

in set_cookies_using_browser function: comment out cookies = self.get_cookies_using_browser() add cookies = self.cookies_from_browser

This should get the cookies only once, when you start each task, but you will not need to get them when you are ready to add to cart. Again not sure this will really work in practice (some may expire or whatever) but that's what I'm currently trying -- and worked on a test purchase.

Just wanted to mention that I made these edits on 10/9/2020 and was able to successfully secure a 3090 FE from best buy (just got the shipping confirmation this weeked)!

The bot prompted me with a "Click to open browser" or something like that, and I was able to complete the checkout from there. I just wanted to say thanks to everyone in this issue thread that was able to resolve all the problems I had with the bot!

Good luck to everyone else trying to get a 3080/3090, this bot with the appropriate edits definitely works!

Jacob101mcd commented 3 years ago

@Vic-in-a-Box my potential solution was to do the following -- which is very much a hack and I'm not sure the cookies will last long enough to make it worth it. But I was able to complete a test purchase without the delay doing this: Add a line like this in the init function: self.cookies_from_browser = self.get_cookies_using_browser() in set_cookies_using_browser function: comment out cookies = self.get_cookies_using_browser() add cookies = self.cookies_from_browser This should get the cookies only once, when you start each task, but you will not need to get them when you are ready to add to cart. Again not sure this will really work in practice (some may expire or whatever) but that's what I'm currently trying -- and worked on a test purchase.

Just wanted to mention that I made these edits on 10/9/2020 and was able to successfully secure a 3090 FE from best buy (just got the shipping confirmation this weeked)!

The bot prompted me with a "Click to open browser" or something like that, and I was able to complete the checkout from there. I just wanted to say thanks to everyone in this issue thread that was able to resolve all the problems I had with the bot!

Good luck to everyone else trying to get a 3080/3090, this bot with the appropriate edits definitely works!

So does the bot work now? Could you clarify what lines, if any I need to change to get it working?

AaronAnz commented 3 years ago

Parapraxis24 details the changes necessary

On Mon, Oct 12, 2020, 7:57 AM Jacob101mcd notifications@github.com wrote:

@Vic-in-a-Box https://github.com/Vic-in-a-Box my potential solution was to do the following -- which is very much a hack and I'm not sure the cookies will last long enough to make it worth it. But I was able to complete a test purchase without the delay doing this: Add a line like this in the init function: self.cookies_from_browser = self.get_cookies_using_browser() in set_cookies_using_browser function: comment out cookies = self.get_cookies_using_browser() add cookies = self.cookies_from_browser This should get the cookies only once, when you start each task, but you will not need to get them when you are ready to add to cart. Again not sure this will really work in practice (some may expire or whatever) but that's what I'm currently trying -- and worked on a test purchase.

Just wanted to mention that I made these edits on 10/9/2020 and was able to successfully secure a 3090 FE from best buy (just got the shipping confirmation this weeked)!

The bot prompted me with a "Click to open browser" or something like that, and I was able to complete the checkout from there. I just wanted to say thanks to everyone in this issue thread that was able to resolve all the problems I had with the bot!

Good luck to everyone else trying to get a 3080/3090, this bot with the appropriate edits definitely works!

So does the bot work now? Could you clarify what lines, if any I need to change to get it working?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/natewong1313/bird-bot/issues/31#issuecomment-707103525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRAG2CLM336U67JLJC5JNDSKL4KFANCNFSM4MNXHQ5A .

Jacob101mcd commented 3 years ago

Parapraxis24 details the changes necessary

Yes, I've read it. However, I can't find where the set_cookies_using_browser function is. Could you elaborate on that part?

DiehardFiero commented 3 years ago

So I made the changes to pull the cookie at the start instead of once it is in stock...does anyone have any idea how long this cookie will last and how often I should restart the task to get a new cookie? Also, I don't know enough about this stuff but if I set it to pull the cookie at the start of each task instead of once in stock, will there be any issues if I run multiple tasks at once?

Edited to add 2nd question

DiehardFiero commented 3 years ago

Parapraxis24 details the changes necessary

Yes, I've read it. However, I can't find where the set_cookies_using_browser function is. Could you elaborate on that part?

Screenshot 2020-10-12 153820 The arrow in this first picture above shows where I added the line "self.cookies_from_browser = self.get_cookies_using_browser()"

Screenshot 2020-10-12 153735 The arrow of the second picture above shows where you replace "cookies = self.get_cookies_using_browser()" with "cookies = self.cookies_from_browser". The 2 lines indicated by the star are lines I added for it to say what it is doing while initiating this process, you don't need them. I only added them because it seemed to take a long time to get the cookie and I wasn't sure if it was working, it seemed like it had frozen.

I hope this helps!

broncosmang commented 3 years ago

I had the issue where when clicking on the "click to open browser" button would launch a browser that immediately closed. Any ideas what the issue there is?

Jacob101mcd commented 3 years ago

@DiehardFiero I get this error, although oddly it only seems to happen on some cards (some of the links).

Error Checking Stock (line 204 ConnectionError HTTPSConnectionPool(host='www.bestbuy.com', port=443): Max retries exceeded with url: /api/tcfb/model.json?paths=%5B%5B%22shop%22%2C%22scds%22%2C%22v2%22%2C%22page%22%2C%22tenants%22%2C%22bbypres%22%2C%22pages%22%2C%22globalnavigationv5sv%22%2C%22header%22%5D%2C%5B%22shop%22%2C%22buttonstate%22%2C%22v5%22%2C%22item%22%2C%22skus%22%2C6436223%2C%22conditions%22%2C%22NONE%22%2C%22destinationZipCode%22%2C%22%2520%22%2C%22storeId%22%2C%22%2520%22%2C%22context%22%2C%22cyp%22%2C%22addAll%22%2C%22false%22%5D%5D&method=get (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9bc04f9c70>: Failed to establish a new connection: [Errno 60] Operation timed out'))) [2020-10-12 17:18:51][TASK 16] Error Checking Stock (line 204 ConnectionError HTTPSConnectionPool(host='www.bestbuy.com', port=443): Max retries exceeded with url: /api/tcfb/model.json?paths=%5B%5B%22shop%22%2C%22scds%22%2C%22v2%22%2C%22page%22%2C%22tenants%22%2C%22bbypres%22%2C%22pages%22%2C%22globalnavigationv5sv%22%2C%22header%22%5D%2C%5B%22shop%22%2C%22buttonstate%22%2C%22v5%22%2C%22item%22%2C%22skus%22%2C6430621%2C%22conditions%22%2C%22NONE%22%2C%22destinationZipCode%22%2C%22%2520%22%2C%22storeId%22%2C%22%2520%22%2C%22context%22%2C%22cyp%22%2C%22addAll%22%2C%22false%22%5D%5D&method=get (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9bc0511fa0>: Failed to establish a new connection: [Errno 60] Operation timed out')))

DiehardFiero commented 3 years ago

@Jacob101mcd Ya that happened to me once randomly...I'm not sure why that happened! It has cleared itself up though...I closed the python window as well as the terminal window and restarted it. Seems to be fine now! Not sure why that happened, that's above my pay grade! Maybe someone else can chime in though haha

Jacob101mcd commented 3 years ago

@Jacob101mcd Ya that happened to me once randomly...I'm not sure why that happened! It has cleared itself up though...I closed the python window as well as the terminal window and restarted it. Seems to be fine now! Not sure why that happened, that's above my pay grade! Maybe someone else can chime in though haha

The bot also freezes after about an hour of running. Stopping and Starting all seems to fix it, but only for another hour.

brandacus commented 3 years ago

I fixed the cookie issue by creating a new thread in the init method that regularly updates the cookies. I'm too lazy to fork the repo and create a new commit, so here's the code. Someone let me know if I overlooked something. I'm refreshing every 5 mins because I'm not sure when the cookies expire. All in bestbuy.py (obviously fix the indentation):

import threading

in init between self.cookies_from_browser = self.get_cookies_using_browser() and if proxy != False:: self.kill_cookie_thread = False cookie_thread = threading.Thread( target=self.launch_cookie_thread, args=(), ) cookie_thread.name = "cookieThread" cookie_thread.daemon = True cookie_thread.start()

at the end of init: self.kill_cookie_thread = True cookie_thread.join()

new method inside the class. I put it next to init: def launch_cookie_thread(self): while(not self.kill_cookie_thread): self.status_signal.emit( {"msg": "Getting Cookies Using Browser", "status": "normal"}) self.cookies_from_browser = self.get_cookies_using_browser() self.status_signal.emit( {"msg": "Got Cookies Using Browser", "status": "normal"}) time.sleep(600)

5150Joker commented 3 years ago

I fixed the cookie issue by creating a new thread in the init method that regularly updates the cookies. I'm too lazy to fork the repo and create a new commit, so here's the code. Someone let me know if I overlooked something. I'm refreshing every 5 mins because I'm not sure when the cookies expire. All in bestbuy.py (obviously fix the indentation):

import threading

in init between self.cookies_from_browser = self.get_cookies_using_browser() and if proxy != False:: self.kill_cookie_thread = False cookie_thread = threading.Thread( target=self.launch_cookie_thread, args=(), ) cookie_thread.name = "cookieThread" cookie_thread.daemon = True cookie_thread.start()

at the end of init: self.kill_cookie_thread = True cookie_thread.join()

new method inside the class. I put it next to init: def launch_cookie_thread(self): while(not self.kill_cookie_thread): self.status_signal.emit( {"msg": "Getting Cookies Using Browser", "status": "normal"}) self.cookies_from_browser = self.get_cookies_using_browser() self.status_signal.emit( {"msg": "Got Cookies Using Browser", "status": "normal"}) time.sleep(600)

Hi, I'm not a programmer but I added in your changes as best as I could and when I execute the script it says "Welcome to Bird Bot" and then just freezes. When I kill the process here's what it says:

image

Here's my bestbuy.py file: https://gofile.io/d/8f2uBX

Thanks.

brandacus commented 3 years ago

I fixed the cookie issue by creating a new thread in the init method that regularly updates the cookies. I'm too lazy to fork the repo and create a new commit, so here's the code. Someone let me know if I overlooked something. I'm refreshing every 5 mins because I'm not sure when the cookies expire. All in bestbuy.py (obviously fix the indentation): import threading in init between self.cookies_from_browser = self.get_cookies_using_browser() and if proxy != False:: self.kill_cookie_thread = False cookie_thread = threading.Thread( target=self.launch_cookie_thread, args=(), ) cookie_thread.name = "cookieThread" cookie_thread.daemon = True cookie_thread.start() at the end of init: self.kill_cookie_thread = True cookie_thread.join() new method inside the class. I put it next to init: def launch_cookie_thread(self): while(not self.kill_cookie_thread): self.status_signal.emit( {"msg": "Getting Cookies Using Browser", "status": "normal"}) self.cookies_from_browser = self.get_cookies_using_browser() self.status_signal.emit( {"msg": "Got Cookies Using Browser", "status": "normal"}) time.sleep(600)

Hi, I'm not a programmer but I added in your changes as best as I could and when I execute the script it says "Welcome to Bird Bot" and then just freezes. When I kill the process here's what it says:

image

Here's my bestbuy.py file: https://gofile.io/d/8f2uBX

Thanks.

I forked the repo and committed my changes along with the other recommended changes in this thread. Try using that instead https://github.com/brandacus/bird-bot/commit/648d995e158c22b165d7196376fd0af8a71bc783

5150Joker commented 3 years ago

I fixed the cookie issue by creating a new thread in the init method that regularly updates the cookies. I'm too lazy to fork the repo and create a new commit, so here's the code. Someone let me know if I overlooked something. I'm refreshing every 5 mins because I'm not sure when the cookies expire. All in bestbuy.py (obviously fix the indentation): import threading in init between self.cookies_from_browser = self.get_cookies_using_browser() and if proxy != False:: self.kill_cookie_thread = False cookie_thread = threading.Thread( target=self.launch_cookie_thread, args=(), ) cookie_thread.name = "cookieThread" cookie_thread.daemon = True cookie_thread.start() at the end of init: self.kill_cookie_thread = True cookie_thread.join() new method inside the class. I put it next to init: def launch_cookie_thread(self): while(not self.kill_cookie_thread): self.status_signal.emit( {"msg": "Getting Cookies Using Browser", "status": "normal"}) self.cookies_from_browser = self.get_cookies_using_browser() self.status_signal.emit( {"msg": "Got Cookies Using Browser", "status": "normal"}) time.sleep(600)

Hi, I'm not a programmer but I added in your changes as best as I could and when I execute the script it says "Welcome to Bird Bot" and then just freezes. When I kill the process here's what it says: image Here's my bestbuy.py file: https://gofile.io/d/8f2uBX Thanks.

I forked the repo and committed my changes along with the other recommended changes in this thread. Try using that instead brandacus@648d995

Thank you, that worked. I did notice while it was grabbing cookies that it did this:

[2020-10-13 13:58:03][TASK 2] Error Getting Cookies From Browser(line 122 WebDriverException Message: Access is denied. (os error 5)
)
[2020-10-13 13:58:03][TASK 2] Got Cookies Using Browser
5150Joker commented 3 years ago

Looks like Best Buy implemented some sort of wait timer on the add to cart button now. Anyone else see that today? image image tg_image_1307728931

Rchimedes commented 3 years ago

Looks like Best Buy implemented some sort of wait timer on the add to cart button now. Anyone else see that today?

image

image

tg_image_1307728931

Yep! So what I did was add one of the cards to my cart (mobile app). Then clicked on my cart and it said it was sold out. Then I clicked on it even though it said sold out and it gave me the option in there to add to cart or buy now. I clicked buy now and in disbelief through the whole checkout process it went through and I was able to snag a 3080 today. I hope this method works for you guys and thought I'd share since everyone here helped me get one. Let me know if you have any questions. You still have to act super fast so make sure you have those Discord alerts going.