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
simplyluka commented 4 years ago

Same thing for any purchase in general. Stuck on adding to cart.

jb05042 commented 4 years ago

Correct, I've tested ~20 small ticket items from best buy and execution will freeze on adding to cart

got156 commented 4 years ago

Same thing happened to me as well

Bahu2016 commented 4 years ago

i guess proxy has to set, but not sure how

ibrummel commented 4 years ago

Same issue. I did some digging and the issues is that for some reason best buy's website is not responding to the add to cart request that is being sent. I have verified that this issue is common to about 20 random items. As far as I can tell, I am not ip banned, because this doesn't change when connected to a VPN or proxy and I am able to manually buy things.

May just be a change to BestBuy's purchasing API, but I can't find any documentation of that anywhere.

jb05042 commented 4 years ago

I believe the images weren't loading due to the task wasn't running, whenever I run the tasks the thumbnails load.

I'm using p3, below is my current setup:

I've uninstalled the bot, reinstalled everything, pulled the updated branch today, restarted my compute etc etc. Still getting the same issue.

bryanjw commented 4 years ago

Is anyone having this issue on a Windows machine?

amarcot93 commented 4 years ago

Is anyone having this issue on a Windows machine?

Yeah, mine freezes on adding to cart with any Best Buy page, running on Windows 10. Tried restarting everything and updating the bot, no change. I haven't dug into it much, just noticed it today

mgroth0 commented 4 years ago

I am having a similar issue. Here's a copy of my log:

[2020-04-23 15:08:21][TASK 1] Checking Stock
[2020-04-23 15:08:22][TASK 1] Waiting For Restock
[2020-04-23 15:08:32][TASK 1] Loading Product Page
[2020-04-23 15:08:33][TASK 1] Checking Stock
[2020-04-23 15:08:34][TASK 1] Adding To Cart
[2020-04-23 15:38:34][TASK 1] Error Adding To Cart (line 123 ConnectionError ('Connection aborted.', OSError("(54, 'ECONNRESET')",)))
[2020-04-23 15:38:46][TASK 1] Adding To Cart
[2020-04-23 16:08:47][TASK 1] Error Adding To Cart (line 123 ConnectionError ('Connection aborted.', OSError("(54, 'ECONNRESET')",)))

And details about my system:

What I am trying to do is purchase this Nintendo Switch from best buy.

Please let me know if there's any other details I can provide that will help. Also, if I'm mistaken and this is a separate issue from OP's, let me know and I'll create a new issue.

hackakhan commented 4 years ago

Is anyone having this issue on a Windows machine?

Windows 10 with Python 3 and I have this same issue. I haven’t sat down to troubleshoot yet.

fdiarte12 commented 4 years ago

The response appears to be a 403 so nothing to do with your OS or python version.

staaain commented 4 years ago

I got stuck on adding to cart too

DeanIsMe commented 4 years ago

Mine is also stuck on adding to cart with Best Buy. Python 3.6.8 and Windows 64bit.

Daycabbage commented 4 years ago

Is anyone having any luck with a work around for this? I tested it with a USB drive purchase and it still just gets stuck at adding to cart. I have no idea where to start troubleshooting this.. I am doing windows updates just for the heck of it.

fostermatt commented 4 years ago

I had the same issue today. Then I attempted to buy a game the website has in stock. The bot just said it was waiting for restock. Not really sure the point of this thing if it can't even see stuff in stock and then if it does it gets stuck trying to add the item to a cart.

RealScatman commented 4 years ago

I had the same issue today. Then I attempted to buy a game the website has in stock. The bot just said it was waiting for restock. Not really sure the point of this thing if it can't even see stuff in stock and then if it does it gets stuck trying to add the item to a cart.

waiting for restock and adding to cart are two separate processes...i showed you how to fix the waiting to restock issue, now I need to figure out why it is stuck at adding to cart. Currently, when attempting to add to cart, best buy api does not send back a response...

Also, big boy websites like best buy, walmart, target, etc. do not want people to have/use checkout bots. They are always updating their systems (i.e. changing api, updating antibot detection, etc.) This is the reason add to cart function does not currently work (Best Buy changed their workflow.)

chadkila commented 4 years ago

I don't think directly using http api is easy to maintain and debug, their front-end scripts may change their way to call the API and you may not aware of that. I spent an hour writing a selenium python script to order items on Amazon, it just needs 100 lines and works much better than this bot.
The only disadvantage of using selenium is more resource consuming because it needs to render the whole webpage, but headless mode and disabling images may help a little.

warherohere commented 4 years ago

The question still remains if corporate businesses change the work flow (RealScantMan) how do we get around that so auto checkout can occur?

dani-rulu commented 4 years ago

did anyone figure it out??

Miniblini commented 4 years ago

Does anyone know the work around for this? It's stuck on adding to cart!

debarrylt commented 4 years ago

Hi all, so I did some digging around and like everyone else, the following post call seems to be ingnored by the Bestbuy servers:

self.session.post("https://www.bestbuy.com/cart/api/v1/addToCart",json=body,headers=headers)

It seems that the following URL "https://api.bestbuy.com/click/-//cart" (replace the sku_id by the one you want) does the job on my webbrowser at least. However, when I do this call in python:

self.session.post("https://api.bestbuy.com/click/-/{0}/cart".format(self.sku_id),json=body,headers=headers,timeout=3)

I get the following error: Route defined in Swagger specification (/click/{hash}/{sku}/{page_type}) but there is no defined post operation.

I am not too familiar with web based APIs so I am not sure what to do next. Any ideas?

nlvguy commented 4 years ago

Hi all, so I did some digging around and like everyone else, the following post call seems to be ingnored by the Bestbuy servers:

self.session.post("https://www.bestbuy.com/cart/api/v1/addToCart",json=body,headers=headers)

It seems that the following URL "https://api.bestbuy.com/click/-//cart" (replace the sku_id by the one you want) does the job on my webbrowser at least. However, when I do this call in python:

self.session.post("https://api.bestbuy.com/click/-/{0}/cart".format(self.sku_id),json=body,headers=headers,timeout=3)

I get the following error: Route defined in Swagger specification (/click/{hash}/{sku}/{page_type}) but there is no defined post operation.

I am not too familiar with web based APIs so I am not sure what to do next. Any ideas?

This is not a post request. Remove the body and use self.session.get()

AaronAnz commented 3 years ago

Hi all, so I did some digging around and like everyone else, the following post call seems to be ingnored by the Bestbuy servers: self.session.post("https://www.bestbuy.com/cart/api/v1/addToCart",json=body,headers=headers) It seems that the following URL "https://api.bestbuy.com/click/-//cart" (replace the sku_id by the one you want) does the job on my webbrowser at least. However, when I do this call in python: self.session.post("https://api.bestbuy.com/click/-/{0}/cart".format(self.sku_id),json=body,headers=headers,timeout=3) I get the following error: Route defined in Swagger specification (/click/{hash}/{sku}/{page_type}) but there is no defined post operation. I am not too familiar with web based APIs so I am not sure what to do next. Any ideas?

This is not a post request. Remove the body and use self.session.get()

You need to grab a cookie from BestBuy.com. Once you have that you can make it to the submitting payment part. I have to try and add the cookie to those post requests too and then I will know whether or not I have fixed it. It should be pretty easy to grab the cookie programatically by sending a get request to bestbuy.com/cart and getting the "set-cookie" response headers but I grabbed the cookie manually through Google Chrome developer tools and it expires 1 year out so you can re-use it indefinitely.

DiehardFiero commented 3 years ago

I'm sorry guys, I'm no programmer...it sounds like either @nikolalv or @AaronAnz have found a work around to make this work. Any way you can give me a step-by-step on how to get around this issue? I'm sure others on here would benefit from a short walkthrough too! Thanks!

AaronAnz commented 3 years ago

Unfortunately I don't have anything fully working as of yet. I'm going to see if I can get it fully working tonight, but I did make it passed the adding to cart loop. I get an error when submitting the payment which could be a whole different beast and unrelated to the cookie. I comment on this issue if I get it working.

On Tue, Sep 15, 2020, 4:41 PM DiehardFiero notifications@github.com wrote:

I'm sorry guys, I'm no programmer...it sounds like either @nikolalv https://github.com/nikolalv or @AaronAnz https://github.com/AaronAnz have found a work around to make this work. Any way you can give me a step-by-step on how to get around this issue? I'm sure others on here would benefit from a short walkthrough too! Thanks!

— 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-693063407, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRAG2HJ53AX5FLHUDXNE6LSF73UDANCNFSM4MNXHQ5A .

DiehardFiero commented 3 years ago

That would be HUGE! Thank you @AaronAnz! I was hoping to use this to snag a 3080 on Thursday morning...it seems to pull the info fine and check stock but it would be great if it could actually check out too! Please let me know if there's anything I can do to help!

datbird commented 3 years ago

Same here @AaronAnz and @DiehardFiero . Hard to compete with all the mass scalper bots with my human hands, eyes and reflexes. Either way thanks for your work Aaron and good luck!

AaronAnz commented 3 years ago

Unfortunately it seemed to not like me passing the cookie around to the other functions and then I was blocked from best buy temporarily or something because it wouldn't add to cart anymore. So I began making a bare bones web browser automater for best buy in c# as I don't have the time to continue messing with BirdBot without it working guaranteed. You might want to check out "best buy bot" on GitHub in the meantime and seeing if you can get it working.Best buy bot requires the chromedriver for whatever version of chrome you have installed ( Google it ). I have no promises I will have mine ready to give to people by the time 3080 releases. It's going to be janky and at the bare minimum for me to get it hopefully working until I can actually dedicate a good amount of time to it which will unfortunately be after the 3080 release.

On Tue, Sep 15, 2020, 9:39 PM datbird notifications@github.com wrote:

Same here @AaronAnz https://github.com/AaronAnz and @DiehardFiero https://github.com/DiehardFiero . Hard to compete with all the mass scalper bots with my human hands, eyes and reflexes. Either way thanks for your work Aaron and good luck!

— 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-693164961, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRAG2DBTVY4RYHB2LEZWSLSGA6QNANCNFSM4MNXHQ5A .

datbird commented 3 years ago

@AaronAnz thanks for taking a gander at it Aaron, definitly not like your job or anything so you are appreciated regardless! I'll check out the best buy bot and/or just roll the dice and do my best with my fingers! Thanks again and good luck! :)

DiehardFiero commented 3 years ago

@AaronAnz Thank you for trying! After seeing your message, I ended up finding this bot and thought I'd give it a try:

https://mostadvancedbot.com/products/bestbuy-bot

It's 60 bucks but I tried it out on a cheap little USB drive and it seemed to work pretty well! I'm going to use it to buy and extra one to sell online to recoup the cost. Anyway, good luck to you guys tomorrow!

mikestamb commented 3 years ago

@DiehardFiero Hello, were you able to snag a 3080 using that bot?

DiehardFiero commented 3 years ago

NO! Ugh....the bot was working fine (and is now working fine) but when 9a rolled around Best Buy changed their site and it screwed up the bot. They initially had a "coming soon" button but when it went live they removed the button ALTOGETHER. Apparently, this is what the bot was monitoring and when it disappeared the bot froze. Eventually, they put an "out of stock" button back up but by that time it was too late. If they had kept the "coming soon" button around until an "add to cart" button was available it would've been fine but they removed it completely and it screwed it up. :(

AaronAnz commented 3 years ago

NO! Ugh....the bot was working fine (and is now working fine) but when 9a rolled around Best Buy changed their site and it screwed up the bot. They initially had a "coming soon" button but when it went live they removed the button ALTOGETHER. Apparently, this is what the bot was monitoring and when it disappeared the bot froze. Eventually, they put an "out of stock" button back up but by that time it was too late. If they had kept the "coming soon" button around until an "add to cart" button was available it would've been fine but they removed it completely and it screwed it up. :(

I actually managed to get one manually through the nvidia store. I never saw best buy change to "Add to cart" ever. It was just Coming Soon straight to Sold Out. I did speak with my local bestbuy assistant manager today and he said more should get posted over the next few days. Keep an eye out. Click the "Notify Me" and keep trying both Nvidia store and bestbuy etc. Good luck!

DiehardFiero commented 3 years ago

@AaronAnz Congrats on being one of the few! Thank you for the heads up on the restocks! Haha Ya I've got the bot running but I don't like it nearly as much as the bird-bot one...it takes up more resources on my computer and doesn't seem to run nearly as fast as the bird-bot one. Are you still trying to get the bird-bot working or have you given up on the add to cart issue?

AaronAnz commented 3 years ago

I'm definitely going to revisit BirdBot this weekend so It can have it for emergencies / if they release the beefier 3080. I'm just busy cause I'm working two jobs Wednesday - Friday.

On Thu, Sep 17, 2020, 12:52 PM DiehardFiero notifications@github.com wrote:

@AaronAnz https://github.com/AaronAnz Congrats on being one of the few! Thank you for the heads up on the restocks! Haha Ya I've got the bot running but I don't like it nearly as much as the bird-bot one...it takes up more resources on my computer and doesn't seem to run nearly as fast as the bird-bot one. Are you still trying to get the bird-bot working or have you given up on the add to cart issue?

— 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-694463452, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRAG2ASCWGESHW6PUQZ24DSGJSHBANCNFSM4MNXHQ5A .

Jacob101mcd commented 3 years ago

@AaronAnz That would be awesome. I actually found bird bot because I got totally screwed at the 3080 launch this morning.

AaronAnz commented 3 years ago

Yeah the only reason I got one was because there was a link circulating that instantly added it to your cart and bypassed the product page. Luckily my friend sent it to me and I was quick enough to place my order. Here's to hoping I don't get my order cancelled ( have confirmation and been charged but who knows )

On Thu, Sep 17, 2020, 2:10 PM Jacob101mcd notifications@github.com wrote:

@AaronAnz https://github.com/AaronAnz That would be awesome. I actually found bird bot because I got totally screwed at the 3080 launch this morning.

— 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-694501364, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRAG2EFLOSDTML5B5PDZCTSGJ3K3ANCNFSM4MNXHQ5A .

datbird commented 3 years ago

@AaronAnz I was also a casualty of todays release slaughter... no card for me :(

That being said thanks again for your work on this, hopefully you manage to get it going for all us sad bois.

AaronAnz commented 3 years ago

So apparently my friend said they came back available for a second on nvidia's website. Look up a stock tracking website and then use this link when they are active again. This link bypasses the product page

https://t.co/jm0rrgxkDl?amp=1

On Thu, Sep 17, 2020, 2:38 PM datbird notifications@github.com wrote:

@AaronAnz https://github.com/AaronAnz I was also a casualty of todays release slaughter... no card for me :(

That being said thanks again for your work on this, hopefully you manage to get it going for all us sad bois.

— 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-694513364, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRAG2A5DJFJJWTEHUAVXNDSGJ6XDANCNFSM4MNXHQ5A .

DiehardFiero commented 3 years ago

Yes, thank you for your work and I hope you are able to get it working too! Thank you for the link, I was actually just about to ask you for that! Word is that NVIDIA is manually checking each order to make sure it's not a bot (not sure how that's working) but I'm hoping more stock will open up as some of these orders get rejected

alim555 commented 3 years ago

@AaronAnz I'm down to try and help you bc I'm also looking for a 3080 and waited in line only to not get 1 today lol. I got some time this weekend. If you can help me figure out how you got past the add to cart error I can start looking into the checkout. I tried getting cookies from bestbuy.com/cart and passing it into the add to cart post but I'm getting the same issue.

AaronAnz commented 3 years ago

I think it's the _abck that you primarily need all the way up to the expiration date and where it says Secure. I made sure it was in string format ( _abck: ) and added a "cookie" header with that data to the addtocart post request. I had gotten up to submitting payment before it errored out. I will do some testing again this weekend ( have changed my IP ) and see if maybe they changed it right as they "released" the 3080 today.

On Thu, Sep 17, 2020, 7:32 PM alim555 notifications@github.com wrote:

@AaronAnz https://github.com/AaronAnz I'm down to try and help you bc I'm also looking for a 3080 and waited in line only to not get 1 today lol. I got some time this weekend. If you can help me figure out how you got past the add to cart error I can start looking into the checkout. I tried getting cookies from bestbuy.com/cart and passing it into the add to cart post but I'm getting the same issue.

— 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-694612210, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRAG2GQCCPZ5AZ22WGU5MDSGLBEPANCNFSM4MNXHQ5A .

LordWolfsack commented 3 years ago

Having the issue as well - tested on a smaller item and it's stuck in "adding to card." HALP! Haha - anyone figure this out?

brandonmendez0415 commented 3 years ago

Got add to cart working by adding "cookie": "_abck: <dataFromChromeInspector>". You only need the _abck part of the cookie field when you inspect the post request in browser. I'm now stuck on an error submitting payment with this error message: {'errors': [{'errorCode': 'INVALID_PAYMENT_CALL_V1', 'errorMessage': 'Payment Id found and unable to proceed'}]} as the response variable. I don't really want to actually purchase something just to inspect the patch request in browser to see if theres a missing header or something, but that might give someone else an idea.

jonnyapp1eseed commented 3 years ago

Got add to cart working by adding "cookie": "_abck: <dataFromChromeInspector>". You only need the _abck part of the cookie field when you inspect the post request in browser. I'm now stuck on an error submitting payment with this error message: {'errors': [{'errorCode': 'INVALID_PAYMENT_CALL_V1', 'errorMessage': 'Payment Id found and unable to proceed'}]} as the response variable. I don't really want to actually purchase something just to inspect the patch request in browser to see if theres a missing header or something, but that might give someone else an idea.

123 r = self.session.post("https://www.bestbuy.com/cart/api/v1/addToCart",json=body,headers=headers) 124 if r.status_code == 200 and json.loads(r.text)["cartCount"] == 1:

Are you adding the bestbuy.py?

"cookie": "_abck:

before r=self.session.post

I added my cookie session, still can't get it to add to cart.

AaronAnz commented 3 years ago

Add "cookie": "" to headers dict within atc(). If it still doesn't work you were probably blocked temporarily. Change your ip / wait 24 hours. You get around 20 trys before their bot protection nabs you and temporarily ignores your requests

On Fri, Sep 18, 2020, 12:31 AM jonnyapp1eseed notifications@github.com wrote:

Got add to cart working by adding "cookie": "_abck:

". You only need the _abck part of the cookie field when you inspect the post request in browser. I'm now stuck on an error submitting payment with this error message: {'errors': [{'errorCode': 'INVALID_PAYMENT_CALL_V1', 'errorMessage': 'Payment Id found and unable to proceed'}]} as the response variable. I don't really want to actually purchase something just to inspect the patch request in browser to see if theres a missing header or something, but that might give someone else an idea. 123 r = self.session.post(" https://www.bestbuy.com/cart/api/v1/addToCart",json=body,headers=headers) 124 if r.status_code == 200 and json.loads(r.text)["cartCount"] == 1: Are you adding the bestbuy.py? "cookie": "_abck: before r=self.session.post I added my cookie session, still can't get it to add to cart. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or unsubscribe .
jonnyapp1eseed commented 3 years ago

Add "cookie": "" to headers dict within atc(). If it still doesn't work you were probably blocked temporarily. Change your ip / wait 24 hours. You get around 20 trys before their bot protection nabs you and temporarily ignores your requests On Fri, Sep 18, 2020, 12:31 AM jonnyapp1eseed @.***> wrote: Got add to cart working by adding "cookie": "_abck: ". You only need the _abck part of the cookie field when you inspect the post request in browser. I'm now stuck on an error submitting payment with this error message: {'errors': [{'errorCode': 'INVALID_PAYMENT_CALL_V1', 'errorMessage': 'Payment Id found and unable to proceed'}]} as the response variable. I don't really want to actually purchase something just to inspect the patch request in browser to see if theres a missing header or something, but that might give someone else an idea. 123 r = self.session.post(" https://www.bestbuy.com/cart/api/v1/addToCart",json=body,headers=headers) 124 if r.status_code == 200 and json.loads(r.text)["cartCount"] == 1: Are you adding the bestbuy.py? "cookie": "_abck: before r=self.session.post I added my cookie session, still can't get it to add to cart. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#31 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRAG2CZQZXPGRZDJTFFSXDSGMEFJANCNFSM4MNXHQ5A

I added the cookie to the correct session in

line 118 "cookie": "_abck: 0E4311092

body = {"items":[{"skuId":self.sku_id}]} while True: self.status_signal.emit({"msg":"Adding To Cart","status":"normal"}) try: r = self.session.post("https://api.bestbuy.com/click/5592e2b895800000/12345678/cart",json=body,headers=headers)

even with this, I can't add to cart. My IP hasn't been blocked. https://api.bestbuy.com/click/5592e2b895800000/12345678/cart (api does not work)

jonnyapp1eseed commented 3 years ago

https://www.bestbuy.com/cart/api/v1/addToCart

Is this API still working? NM tested API and it doesn't work.

mikestamb commented 3 years ago

@jonnyapp1eseed I was trying to mess with the POST addToCart api call yesterday on BestBuy's developers api documentation website and its asking for a api key/authentication when using the "addToCart" call. Does anyone know how this bot was interacting with BestBuy's API without a api key? Or does it have a key the OP programmed into the files? I'm not sure and correct me if I'm wrong but it seems to me that BestBuy may have disabled the "addToCart" api call.

brandonmendez0415 commented 3 years ago

The add to cart call works (it's how your browser adds an item to your cart in the first place), though you need to manually add an item to cart and get the cookie information from the addToCart network request in a browser inspector first. Then you can add that cookie information to the headers variable like we described above and it'll work in the bot. I can't work on this myself right now but it would be ideal if someone could figure out a way for this to be done programmatically so there isn't any manual work involved.

Regardless, we're still stuck on the payment submission step, so that's another roadblock.

@jonnyapp1eseed post your whole headers variable, there's probably something wrong there.