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
jonnyapp1eseed 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.

def atc(self): headers={ "accept": "application/json", "accept-encoding": "gzip, deflate, br", "accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7", "content-length": "31", "content-type": "application/json; charset=UTF-8", "origin": "https://www.bestbuy.com", "referer": self.product, "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36", "cookie": "_abck: 0E4311092B58FBD2F667C92EF86EE22D~0~YAAQKgwRYPyN/pR0AQAAyAw0oAQ1YcD4CGUsZoMpU1PiwOQHIOzd+sU6eCfpi9PQwP7dxczIEhzjU6WTmecVw1AtR/+YohXzwc9q+hA1rjscYnW9Lpwt29sW1uznKEatPxz+F5yoBIbTef1Ss1U/s6BUiCDtHWlmkYb+KSRF9ugthAePWFynDgcxdJe0yTuqQQmqLzsUd/UuTKFUk5Msh3ubMrTdlwiwTr/6vrmhld1gF3Fw4kCxJPfuu+vQi7afm1SJoy4E9mnYkq5Mf4o497AI89j0b5IvhiGs56xp8fSxP6R2bNDQq+kO9hIIETRCeNs4SRX+yzU=~-1~||-1||~-1" }

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.

def atc(self): headers={ "accept": "application/json", "accept-encoding": "gzip, deflate, br", "accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7", "content-length": "31", "content-type": "application/json; charset=UTF-8", "origin": "https://www.bestbuy.com", "referer": self.product, "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36", "cookie": "_abck: 0E4311092B58FBD2F667C92EF86EE22D~0~YAAQKgwRYPyN/pR0AQAAyAw0oAQ1YcD4CGUsZoMpU1PiwOQHIOzd+sU6eCfpi9PQwP7dxczIEhzjU6WTmecVw1AtR/+YohXzwc9q+hA1rjscYnW9Lpwt29sW1uznKEatPxz+F5yoBIbTef1Ss1U/s6BUiCDtHWlmkYb+KSRF9ugthAePWFynDgcxdJe0yTuqQQmqLzsUd/UuTKFUk5Msh3ubMrTdlwiwTr/6vrmhld1gF3Fw4kCxJPfuu+vQi7afm1SJoy4E9mnYkq5Mf4o497AI89j0b5IvhiGs56xp8fSxP6R2bNDQq+kO9hIIETRCeNs4SRX+yzU=~-1~||-1||~-1" }

Should be "_abck=0E4311092B58FBD2F667C92EF86EE22D~0~YAAQKgwRYPyN/pR0AQAAyAw0oAQ1YcD4CGUsZoMpU1PiwOQHIOzd+sU6eCfpi9PQwP7dxczIEhzjU6WTmecVw1AtR/+YohXzwc9q+hA1rjscYnW9Lpwt29sW1uznKEatPxz+F5yoBIbTef1Ss1U/s6BUiCDtHWlmkYb+KSRF9ugthAePWFynDgcxdJe0yTuqQQmqLzsUd/UuTKFUk5Msh3ubMrTdlwiwTr/6vrmhld1gF3Fw4kCxJPfuu+vQi7afm1SJoy4E9mnYkq5Mf4o497AI89j0b5IvhiGs56xp8fSxP6R2bNDQq+kO9hIIETRCeNs4SRX+yzU=~-1~||-1||~-1;"

looks like you're missing a semi-colon at the end of the _abck field and are using a colon instead of = at the beginning. Also, maybe remove the referer field from the headers.

nicpadilla commented 3 years ago

Do we not need access to the Best Buy commerce API? It seems like that is non-public and requires an API key, though I could be wrong on this.

brandonmendez0415 commented 3 years ago

No, we're trying to make the same calls that your browser makes when you go through the checkout process, and that of course doesn't require an API key. It's probably something simple we're missing, but again I don't really want to go through the hassle of purchasing something just to inspect the network request. @AaronAnz might have figured something out by now hopefully. It's just the payment submission step that we're left with now.

Jacob101mcd commented 3 years ago

Once we get it fixed will we have to create a new project or will @AaronAnz be able to push an update?

Kpatl commented 3 years ago

Guys, I am new to this. I am using bird bot to buy a Ps5 and I am getting this error when I try a test on a small item. The most experience I have with coding is AP Comp. Sci Principles lol. So please help me out. From what I have read I see that you can request cookies and add a different API call to fix it. How would I go about doing that? @AaronAnz ? mabye

Kpatl commented 3 years ago

like where do i add "cookie": "_abck: "

AaronAnz commented 3 years ago

atc() function to the headers dictionary you add "cookie": "_abck=<DATA YOU PULLED FROM CHROME>"

On Sat, Sep 19, 2020 at 7:12 PM Kpatl notifications@github.com wrote:

like where do i add "cookie": "_abck: "

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

Kpatl commented 3 years ago

Where is the headers dictionary? @AaronAnz. Also, how can I get bird bot to secure a ps5 from walmart and bestbuy?

Kpatl commented 3 years ago

Currently walmart is on a waiting for restock loop even though my test item is in stock

Kpatl commented 3 years ago

I'm sorry for not knowing much about this program. I am very interested in it and want to learn more about it. Your help in getting it working would mean the world to me. @AaronAnz

mitchcapper commented 3 years ago

@Kpatl this isn't really the proper place try discord for general discussion this is more about the bug. As it stands payment still throws an error but if a solution is found then a patch or fork may be available with it so maybe wait for that.

kollabe commented 3 years ago

Ok i was experiencing the exact same add to cart issue, and fixed it by doing this (as described above):

@ atc(self) .. add this line in between the header values: "cookie": '_abck=COOKIEDATA',

(Cookiedata is NOT end with ; ... it ends with ~-1 in my case. ) it worked and now passes the add to cart. but now there's a new issue. it comes with a new error right after submitting payment:

Error Submitting Payment (line 258 KeyError 'id')

which is this line: 255 try: 256 r = self.session.patch("https://www.bestbuy.com/checkout/orders/{}/paymentMethods".format(self.order_id),json=body,headers=headers) 257 r = json.loads(r.text) 258 if r["id"] == self.order_id: 259 self.status_signal.emit({"msg":"Submitted Payment","status":"normal"}) 260 return

already tried several cards. What gives?

Kpatl commented 3 years ago

@mitchcapper i would love the discord. What is it called and do I need an invite?

mikestamb 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.

def atc(self): headers={ "accept": "application/json", "accept-encoding": "gzip, deflate, br", "accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7", "content-length": "31", "content-type": "application/json; charset=UTF-8", "origin": "https://www.bestbuy.com", "referer": self.product, "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36", "cookie": "_abck: 0E4311092B58FBD2F667C92EF86EE22D~0~YAAQKgwRYPyN/pR0AQAAyAw0oAQ1YcD4CGUsZoMpU1PiwOQHIOzd+sU6eCfpi9PQwP7dxczIEhzjU6WTmecVw1AtR/+YohXzwc9q+hA1rjscYnW9Lpwt29sW1uznKEatPxz+F5yoBIbTef1Ss1U/s6BUiCDtHWlmkYb+KSRF9ugthAePWFynDgcxdJe0yTuqQQmqLzsUd/UuTKFUk5Msh3ubMrTdlwiwTr/6vrmhld1gF3Fw4kCxJPfuu+vQi7afm1SJoy4E9mnYkq5Mf4o497AI89j0b5IvhiGs56xp8fSxP6R2bNDQq+kO9hIIETRCeNs4SRX+yzU=~-1~||-1||~-1" }

Should be "_abck=0E4311092B58FBD2F667C92EF86EE22D~0~YAAQKgwRYPyN/pR0AQAAyAw0oAQ1YcD4CGUsZoMpU1PiwOQHIOzd+sU6eCfpi9PQwP7dxczIEhzjU6WTmecVw1AtR/+YohXzwc9q+hA1rjscYnW9Lpwt29sW1uznKEatPxz+F5yoBIbTef1Ss1U/s6BUiCDtHWlmkYb+KSRF9ugthAePWFynDgcxdJe0yTuqQQmqLzsUd/UuTKFUk5Msh3ubMrTdlwiwTr/6vrmhld1gF3Fw4kCxJPfuu+vQi7afm1SJoy4E9mnYkq5Mf4o497AI89j0b5IvhiGs56xp8fSxP6R2bNDQq+kO9hIIETRCeNs4SRX+yzU=~-1~||-1||~-1;"

looks like you're missing a semi-colon at the end of the _abck field and are using a colon instead of = at the beginning. Also, maybe remove the referer field from the headers.

Thanks for the help @brandonmendez0415 , even though this method fixed the issue where the program gets stuck on "Adding To Cart" and we successfully get the "Added To Cart" message, is it actually adding to our shopping cart? or is it just tricking the program to make it think the item has been added? It doesn't seem to be placing the item in our cart on the website, the cart remains empty.

mikestamb commented 3 years ago

@brandonmendez0415 I just RE-read your post more carefully and now see that you stated "...it'll work in the bot." guessing that means its not actually working in the real world :/

Cmatttt commented 3 years ago

So I have been trying to work on the submitting payment error and it looks to need a cookie added like the add to cart fix but I am struggling to to get added correctly. Have you made progress? @AaronAnz

Khirsah commented 3 years ago

Disclaimer: I am not an expert....

But through my tests/investigation, the api appears to only work on items that are currently available to purchase, but out of stock. This does not work for pre-order items. So those of you who are trying to nab a PS5 preorder are out of luck. You will have to wait until after the ps5 is available for purchase, then the bot will 'work' for you.

That being said, I have been unsuccessful in getting the bot to order anything for me. I get the error submitting payment as well which I am assuming is cookie related - I don't know jack about cookies except they taste good. You can fairly easily write a program that will simulate button clicks and navigate a webpage for you, which could be used to make a pre-order purchase. You could do something in Python in just a few hours even if you never programmed before.

mitchcapper commented 3 years ago

_abck is https://www.akamai.com/us/en/products/security/bot-manager.jsp there are generators for the cookie on GH, or you can harvest using a browser-driver. You can just insert the cookie at init you don't need to continue to add it. You can persist the cookie to checkout but it is not the payment error.

There is no reason it shouldn't work for pre-orders but I don't believe it checks out for pre-orders or for-sale items currently.

To debug you would be best to proxy the connection and compare an actual browser session to this app to see the differences on payment.

This bug report should be left to actual progress on debugging and less questions or how-tos.

As @Khirsah mentioned you could use a browser-driver for everything probably with more success. Something like https://secretagent.dev as well can simplify driving.

Please try to keep the ticket to actual progress

brandonmendez0415 commented 3 years ago

I just tried using the _abck token from the session variable generated by the requests module and that didn't work, only tokens I grab myself from inspecting the network requests in a browser session have gotten me past add to cart.

I also tried actually purchasing a USB drive to inspect those requests but I couldn't find a network call that matched the patch request in the submit payment function and I don't really want to make more purchases just to test this out (even though I did cancel that USB drive order).

In browser I was stopped by my bank and asked to enter a 2FA code they sent to my phone but the screen eventually went away even though I never entered the code and the order was confirmed normally. Not sure if that will affect automation.

@mitchcapper can you link to one of those generators? I am also hesitant to use a browser-driver as in the case of the 3080 launch last thursday, the retail website never even showed an add to cart option in browser before it went out of stock. This leads me to believe that it would be faster to directly make the http requests rather than try to emulate a human operating a browser.

mitchcapper commented 3 years ago

@brandonmendez0415 sorry I cannot, but its a unique string googling should turn it up.
Per the bot documentation it fingerprints your browser, so yes the _abck cookie bird-bot has is not going to cut it (thats why add to cart hangs). As per harvesting keep in mind you could pre-harvest ones ahead of time and they still work for using requests in bird-bot rather than an actual browser.

As for figuring out the payment issue one could try with pre-orders that can be cancelled, but as I personally don't use this bot I only looked at the add to cart issue.

brandonmendez0415 commented 3 years ago

@mitchcapper Yea I only asked because googling did not turn it up and you seemed sure that they existed. I just discovered that consecutive requests with the same functioning _abck token were being blocked, so it looks like the issue is getting worse. I'd like to figure out how the token is generated in the first place, but I guess keeping that from happening is the anti-bot company's whole job.

kollabe commented 3 years ago

did anyone figure out the payment issue now? :/

ByteDestroyer commented 3 years ago

There are a few errors, or things that have changed, since the last time the bot worked. There is a cookie that is needed in order for the server to respond to the add_to_cart part, the server does not respond to the request without this cookie. That cookie can be generated using a browser. I used Firefox but the bot uses Chrome on utils.py, you can use it as reference. Regarding the payment, the body of the request has now a different format, some of the fields were changed or renamed. Also, the payment URL is no longer using the order_id, it uses payment ID now. Be aware that there are also a couple of requests that need to be made before the checkout is completed and the shipping information is send. Last, but not least, there is a request that need to be made to refresh the payment. Please use the bot as your code skeleton but be aware that many things has changed. My suggestion is use the above information as reference and play with a proxy to figure out what are you missing. Hope you can make it works as well.

jau5mann commented 3 years ago

There are a few errors, or things that have changed, since the last time the bot worked. There is a cookie that is needed in order for the server to respond to the add_to_cart part, the server does not respond to the request without this cookie. That cookie can be generated using a browser. I used Firefox but the bot uses Chrome on utils.py, you can use it as reference. Regarding the payment, the body of the request has now a different format, some of the fields were changed or renamed. Also, the payment URL is no longer using the order_id, it uses payment ID now. Be aware that there are also a couple of requests that need to be made before the checkout is completed and the shipping information is send. Last, but not least, there is a request that need to be made to refresh the payment. Please use the bot as your code skeleton but be aware that many things has changed. My suggestion is use the above information as reference and play with a proxy to figure out what are you missing. Hope you can make it works as well.

I updated the following call in bestbuy.py: self.session.patch("https://www.bestbuy.com/checkout/orders/{}/paymentMethods".format(self.order_id))

to the call I found while manually going through the checkout flow (I define self.payment_id earlier in the file): self.session.put("https://www.bestbuy.com/payment/api/v1/payment/{}/creditCard".format(self.payment_id)

I also updated the billingAddress and creditCard objects passed in the body to match what I found. Now, I'm getting the following error:

{'errors': [{'errorCode': 'UNAUTHORIZED', 'errorMessage': 'token cannot be null or blank', 'description': 'token cannot be null or blank'}]}

When I examine this call in Chrome Dev Tools from when I manually checked out, I don't see any kind of obvious token being passed in the headers. I tried passing the entire cookies header, but still got the same error.

Anyone have any idea how to obtain/pass the token described in the above error?...or whether I'm completely off-base and am going in the wrong direction?

ByteDestroyer commented 3 years ago

There are a few errors, or things that have changed, since the last time the bot worked. There is a cookie that is needed in order for the server to respond to the add_to_cart part, the server does not respond to the request without this cookie. That cookie can be generated using a browser. I used Firefox but the bot uses Chrome on utils.py, you can use it as reference. Regarding the payment, the body of the request has now a different format, some of the fields were changed or renamed. Also, the payment URL is no longer using the order_id, it uses payment ID now. Be aware that there are also a couple of requests that need to be made before the checkout is completed and the shipping information is send. Last, but not least, there is a request that need to be made to refresh the payment. Please use the bot as your code skeleton but be aware that many things has changed. My suggestion is use the above information as reference and play with a proxy to figure out what are you missing. Hope you can make it works as well.

I updated the following call in bestbuy.py: self.session.patch("https://www.bestbuy.com/checkout/orders/{}/paymentMethods".format(self.order_id))

to the call I found while manually going through the checkout flow (I define self.payment_id earlier in the file): self.session.put("https://www.bestbuy.com/payment/api/v1/payment/{}/creditCard".format(self.payment_id)

I also updated the billingAddress and creditCard objects passed in the body to match what I found. Now, I'm getting the following error:

{'errors': [{'errorCode': 'UNAUTHORIZED', 'errorMessage': 'token cannot be null or blank', 'description': 'token cannot be null or blank'}]}

When I examine this call in Chrome Dev Tools from when I manually checked out, I don't see any kind of obvious token being passed in the headers. I tried passing the entire cookies header, but still got the same error.

Anyone have any idea how to obtain/pass the token described in the above error?...or whether I'm completely off-base and am going in the wrong direction?

You need dtCookie, this values can be get it making a request to /cart using a browser. Make sure you wait a few seconds before getting the cookies because that cookie get a bad value by default.

jau5mann commented 3 years ago

@ByteDestroyer I'm passing dtcookie in the cookie header of submit_payment, but I'm still getting this error. Is there something else I need to do? Do I need to add it somewhere else?

Thanks for your help!

ByteDestroyer commented 3 years ago

@ByteDestroyer I'm passing dtcookie in the cookie header of submit_payment, but I'm still getting this error. Is there something else I need to do? Do I need to add it somewhere else?

Thanks for your help!

Check how the cookie looks like. A valid cookie should start with v_4srv

jau5mann commented 3 years ago

@ByteDestroyer tried 2 different ones now, both with that prefix, and neither worked unfortunately.

Kpatl commented 3 years ago

Is this bot working on BestBuy now?

fulltilt commented 3 years ago

There are a few errors, or things that have changed, since the last time the bot worked. There is a cookie that is needed in order for the server to respond to the add_to_cart part, the server does not respond to the request without this cookie. That cookie can be generated using a browser. I used Firefox but the bot uses Chrome on utils.py, you can use it as reference. Regarding the payment, the body of the request has now a different format, some of the fields were changed or renamed. Also, the payment URL is no longer using the order_id, it uses payment ID now. Be aware that there are also a couple of requests that need to be made before the checkout is completed and the shipping information is send. Last, but not least, there is a request that need to be made to refresh the payment. Please use the bot as your code skeleton but be aware that many things has changed. My suggestion is use the above information as reference and play with a proxy to figure out what are you missing. Hope you can make it works as well.

I updated the following call in bestbuy.py: self.session.patch("https://www.bestbuy.com/checkout/orders/{}/paymentMethods".format(self.order_id))

to the call I found while manually going through the checkout flow (I define self.payment_id earlier in the file): self.session.put("https://www.bestbuy.com/payment/api/v1/payment/{}/creditCard".format(self.payment_id)

I also updated the billingAddress and creditCard objects passed in the body to match what I found. Now, I'm getting the following error:

{'errors': [{'errorCode': 'UNAUTHORIZED', 'errorMessage': 'token cannot be null or blank', 'description': 'token cannot be null or blank'}]}

When I examine this call in Chrome Dev Tools from when I manually checked out, I don't see any kind of obvious token being passed in the headers. I tried passing the entire cookies header, but still got the same error.

Anyone have any idea how to obtain/pass the token described in the above error?...or whether I'm completely off-base and am going in the wrong direction?

I made the same modifications as you did (changing the /creditCard url, using payment_id, updating the billingAddress and creditCard objects to match what it looks like on the site) as well as updated the headers and am finally getting the same error message:

{ "errors": [ { "errorCode": "UNAUTHORIZED", "errorMessage": "token cannot be null or blank", "description": "token cannot be null or blank" } ] }

Have you made progress the issue? I too passed in the 'dtcookie' cookie with a prefix of 'v_4srv' and I still get that error

jau5mann commented 3 years ago

@fulltilt I have not, unfortunately. Haven’t really looked at this since I first posted that last comment.

Z3R0th-13 commented 3 years ago

Seems like you get UNAUTHORIZED if you aren't submitting the cookies all in one string.

For example, if I separate out the _abck string and add it into the headers in a different line I get image

But if I keep it all in the same blob of cookie, then I get image

Though I'm not quite sure I'm getting a response for no payment data found since I verified the body is getting sent which contains all of the data.

I also observed that the value of _abck changes with every POST, though it doesn't seem to matter what is passed for the cookie value as long as it came from a browser.

fulltilt commented 3 years ago

Seems like you get UNAUTHORIZED if you aren't submitting the cookies all in one string.

For example, if I separate out the _abck string and add it into the headers in a different line I get image

But if I keep it all in the same blob of cookie, then I get image

Though I'm not quite sure I'm getting a response for no payment data found since I verified the body is getting sent which contains all of the data.

I also observed that the value of _abck changes with every POST, though it doesn't seem to matter what is passed for the cookie value as long as it came from a browser.

I'm literally copying the entire cookie string from the browser (I've been using the cookie I get in the Request headers when adding to cart on the site) and setting that as the "cookie" header. Is that what you're doing as well?

ByteDestroyer commented 3 years ago

You guys can get it working from #68. Its tested on Ubuntu and its working. You can troubleshoot from there or only copy bestbuy.py into your code. Hope that can help.

fulltilt commented 3 years ago

You guys can get it working from #68. Its tested on Ubuntu and its working. You can troubleshoot from there or only copy bestbuy.py into your code. Hope that can help.

Get out of here with that nicely formatted code BS....haha.

This is awesome. I'll try this later tonight and look forward to reading through your changes. I'm new to making bots so this base project has been a great learning tool, even in its broken state.

DiehardFiero commented 3 years ago

@ByteDestroyer Hey! Thank you for doing the update! I'm running windows and copied over the new best buy.py and utils.py. I tried to test the bot, I got this error and it's stuck on the adding to cart. Did I do something wrong or is there still an issue going on?

Welcome To Bird Bot [2020-10-06 19:18:21][TASK 1] Starting [2020-10-06 19:18:21][TASK 1] Checking Stock [2020-10-06 19:18:22][TASK 1] Getting TAS Data [2020-10-06 19:18:23][TASK 1] Got TAS Data [2020-10-06 19:18:23][TASK 1] Getting Cookies from Selenium [2020-10-06 19:18:23][TASK 1] Error Getting Cookies From Browser(line 98 FileNotFoundError [Errno 2] No such file or directory: '/dev/null') [2020-10-06 19:18:23][TASK 1] Loading Product Page [2020-10-06 19:18:24][TASK 1] Adding To Cart

ByteDestroyer commented 3 years ago

@ByteDestroyer Hey! Thank you for doing the update! I'm running windows and copied over the new best buy.py and utils.py. I tried to test the bot, I got this error and it's stuck on the adding to cart. Did I do something wrong or is there still an issue going on?

Welcome To Bird Bot [2020-10-06 19:18:21][TASK 1] Starting [2020-10-06 19:18:21][TASK 1] Checking Stock [2020-10-06 19:18:22][TASK 1] Getting TAS Data [2020-10-06 19:18:23][TASK 1] Got TAS Data [2020-10-06 19:18:23][TASK 1] Getting Cookies from Selenium [2020-10-06 19:18:23][TASK 1] Error Getting Cookies From Browser(line 98 FileNotFoundError [Errno 2] No such file or directory: '/dev/null') [2020-10-06 19:18:23][TASK 1] Loading Product Page [2020-10-06 19:18:24][TASK 1] Adding To Cart

@DiehardFiero You have to remove the line 'service_log_path="/dev/null",' if you are using windows. That path only exists on Linux.

DiehardFiero commented 3 years ago

@ByteDestroyer It worked! Thank you! I eliminated that line and it proceeded on.

For those doing this on Windows, I did have to do one more thing. I had to download the latest geckodriver, unzip it, and put the geckodriver.exe file in the bird-bot folder. After that I ran a test and it worked like a dream! Thank you to everyone, especially @ByteDestroyer , for making this work again!

jonnyapp1eseed commented 3 years ago

@ByteDestroyer Thanks buddy, you are a life saver!!

WhyteDem0n commented 3 years ago

You guys can get it working from #68. Its tested on Ubuntu and its working. You can troubleshoot from there or only copy bestbuy.py into your code. Hope that can help.

@ByteDestroyer When I replace the stock bestbuy.py with your updated one, the status on the tasks gets stuck at "Checking Stock". I removed the service_log_path="/dev/null line as you mentioned and I even tried putting the geckodriver.exe in the root bird-bot folder as @DiehardFiero mentioned (I tried both the x32 and x64 versions found here).

fulltilt commented 3 years ago

Late to post this but I got this working this morning on MacOS

DiehardFiero commented 3 years ago

You guys can get it working from #68. Its tested on Ubuntu and its working. You can troubleshoot from there or only copy bestbuy.py into your code. Hope that can help.

@ByteDestroyer When I replace the stock bestbuy.py with your updated one, the status on the tasks gets stuck at "Checking Stock". I removed the service_log_path="/dev/null line as you mentioned and I even tried putting the geckodriver.exe in the root bird-bot folder as @DiehardFiero mentioned (I tried both the x32 and x64 versions found here).

2 things...did you replace the original utils.config file with his new one as well? Also, are you sure that the item you are entering in there is in stock? If it's not in stock it'll stay on "checking stock" until it comes back in stock.

alim555 commented 3 years ago

You guys can get it working from #68. Its tested on Ubuntu and its working. You can troubleshoot from there or only copy bestbuy.py into your code. Hope that can help.

@ByteDestroyer When I replace the stock bestbuy.py with your updated one, the status on the tasks gets stuck at "Checking Stock". I removed the service_log_path="/dev/null line as you mentioned and I even tried putting the geckodriver.exe in the root bird-bot folder as @DiehardFiero mentioned (I tried both the x32 and x64 versions found here).

I'm also getting the error "Error Getting Cookies From Browser(line 98 SessionNotCreatedException Message: Unable to find a matching set of capabilities" after replacing both files and adding the drivers and removing the mentioned line on windows.

jau5mann commented 3 years ago

Late to post this but I got this working this morning on MacOS

@fulltilt did you have to edit anything after replacing bestbuy.py and utils.py to get it to work on Mac? I'm currently stuck on the Authorizing Card (2) step. However, I think there's an issue with the previous step since I'm getting an Oops! An error occurred!!! page after it.

fulltilt commented 3 years ago

Late to post this but I got this working this morning on MacOS

@fulltilt did you have to edit anything after replacing bestbuy.py and utils.py to get it to work on Mac? I'm currently stuck on the Authorizing Card (2) step. However, I think there's an issue with the previous step since I'm getting an Oops! An error occurred!!! page after it.

No, I didn't have to modify anything after replacing the two files.

Vic-in-a-Box 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!

jeffgolden 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.

5150Joker commented 3 years ago

BB just had a big drop of 3080s and unfortunately even w/these above fixes the bot got stuck on "adding to cart" and never checked out.

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"