-
-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bot Getting Beat Out... #41
Comments
I would first look into perhaps changing the logging and seeing the list of reservations that are available. I've noticed that restaurants sometimes have very weird time slots available (e.g. reservations at 5 PM or 9 PM and later and nothing in between). The bot is purposely set to not dump out the output because that would slow the bot down. It uses log4j which if you are familiar with it, you can just set it to debug mode, and then it will dump out the API responses. |
Take Don Angie in NYC for example - this spot opens reservations 7 days out at 9am. I was on at that time and instantly the slots from 7-8:30 were all gone, they never even showed up. And not even one full second later, the rest of the times were all gone. Every slot taken in 2 seconds. So the question: is there a way to speed this code up even further to beat other bots? Seems like more people are deploying their own. |
Per my statement above, they don't always have all times available. I noticed that many of the top restaurants have very weird times available. Many only have like 5 to 5:30 PM and then 9 PM and afterwards. I have tried Don Angie once or twice simply to see the times that are available and it does have weird times. Also Don Angie is a very tiny restaurant so likely you are fighting for very few spots as well. Now if on the initial query, you see the available times and it's not able to get any of those time slots, then perhaps it is getting beat out. Are there days that sometimes I don't get a reservation? Sure it happens. But realize even if you have the fastest bot and 9 other people do as well, you can only reasonably win 10% of the time. I can try experimenting with Don Angie a bit to see if I'm seeing the same issue as you but it will take a bit of time for me to come to any conclusion since I can only try once a day on top of other reservations I'm trying to get. |
I love this bot but it seems to take the bot 8 seconds to complete a snipe...any way to speed this up via more concurrent processes? I think other bots may be going slightly faster & out sniping. I tried to get 4 Charles Prime Rib 3 days in a row and kept on getting out sniped :( |
What really matters is the time from when the bot runs to the moment it tries to book the reservation. For me, this is about 2-3 seconds. The API call to book the reservation can sometimes take more than 5 seconds to return. There is nothing you can do here as it's up to resy to return the response.
This is similar to what I mentioned above. Many popular restaurants have weird reservation times. In some cases, I try to grab any reservation between 5 PM and 9 PM. This is why I added support for a priority list of reservation times because the list of available times can change from day to day and are usually very sparse. FWIW, I almost always get a reservation at 4 Charles so I think it has something to do with the times you are sniping @J-clouds.
So I wrote the bot in a certain way, find available reservations, pick one, then grab it. In following that workflow, this is basically the fastest it can be aside from picking faster libraries or a "faster programming language". Since it's a single dependent workflow, more concurrent processes does not help here. You can skip the first step in finding a reservation and just do a blind snipe. The concern here is of course it's a blind snipe. So you'd have to blind snipe all available spots. The problem here is you leave it up to fate of what reservation you end up getting. Also, I don't particularly want to bombard resy with a ton of requests. It's basically a DDOS and I imagine they could ban people for doing that. You can blind snipe in priority order but I've noticed that many popular restaurants already have very few spots available. So you'd have to be lucky in knowing what spots they tend to make available and then sniping it. While it may increase the success rate, it makes the usability of this bot much too complicated and I opted to optimize for ease of use. In conclusion, I'm apt to not change anything here. I did try Don Angie today and I got a table. I'll keep on testing it out and you are more than welcome to try to help me improve it but in this case, I would rather optimize for utility than speed. If there is one restaurant I can't get a reservation at but it works well enough for the rest, I'm ok with that. This may not be the most desirable answer but I hope you understand my reasoning around this. |
Any particular advice for Don Angie specifically? I've tried every day at 9am for the last week and have even had 5pm at the top of the priority list to try improve my chances but haven't been able to secure anything. Every other restaurant I've tried, I've managed to secure a reservation (so thank you so much for that!). |
Thanks for your response! This makes lots of sense - you definitely did a good job with the coding so I want to make sure it's clear I genuinely appreciate it. Just thinking about how we can continue to optimize it, is there a possibility to add a range of times in which the bot can choose from? I know I can leave the time blank & the bot will choose any open time but it could be really good to enable the bot to choose any open time between 5-7pm for example. What do you think? |
So I've not sniped it more than the one time I tried but a few things I can share...
|
Heard you loud and clear! It's great to hear the praise and that people are getting value out of it!
This is an interesting thought. I would like the interface to be clean in terms of going for specific time slots or a range of times. I chose to go with specific times as it provided the highest granularity and can easily support searching a range of times. It would be nice to have a more succinct way to search for a range of times but I'll have to think about it. It's not necessarily providing any new functionality it's not really at the top of my list of things to add.
Not sure what you meant here but I don't think you can actually leave the time blank unless this is a bug and I completely missed this use case. |
So what I mean by this is, if you don't set the table type, it will pick any table time for that specific time slot. The time is always required. The table type is always optional. I updated the documentation in this PR (👉 #59) to make that a little bit more clear. |
BTW @seanmcquade20, I've tried a few more times and I've been able to more or less reliably get reservations at Don Angie. Their time slot availability is less consistent so you do may have to widen your search criteria to increase your chances of success. |
How do you widen your search criteria and know what time slots to specifically choose? That's the hardest part for me bc if they're fully booked immediately, I don't even know what time slots to put into the bot...does that make sense? |
You just add more times you want. That's why I made it with a priority list as it searches in that order. Most restaurants have 15-minute time increments so you really just need to play with it. |
Thank you so much for this code! It's working great. Not an issue but just two questions, if you know (and if not feel free to ignore):
|
Really appreciate the compliments! Keeps me motivated to improve or at least to maintain this code.
I find this varies. Some restaurants have the same consistently weird times (e.g. only 5 PM to 5:30 PM available then 9 PM and after) or the times are all over the place. For Don Angie specifically in testing it out for a week or so, I found the times vary a lot and like every 3rd or 4th day, there are zero spots available which I assume is because it's booked for a private event. TL;DR, every restaurant is different and you have to query it a few times on different days to see which tables tend to be available.
I assume you mean make that change, not implement since it's already implemented 😛. It's pretty easy. Just go into |
How do you know what time reservations open? For example I'm trying to book Casa Cruz but don't know what time to set the snipe for, Thank you. |
@martykebke see my reply below.
Honestly, you should give an even wider number of times. I basically snipe for every time slot from open to close in 15-minute increments.
What I noticed is that the same time slot has multiple unique booking tokens. So even though you might have not gotten that slot, you can still get the same slot with a different token so it will retry the same time again. |
@shaggy2626 You can flip the log4j file to debug and it will spit out what times are available. Alternatively, you can just snipe every time slot. |
Hi,
Thank you for your response. I guess what I meant to say was how do I know
what time to actually start the sniper.
On Tue, Dec 13, 2022 at 10:28 AM Derek Fong ***@***.***> wrote:
How do you know what time reservations open? For example I'm trying to
book Casa Cruz but don't know what time to set the snipe for, Thank you.
@shaggy2626 <https://github.com/shaggy2626> You can flip the log4j file
to debug and it will spit out what times are available. Alternatively, you
can just snipe every time slot.
—
Reply to this email directly, view it on GitHub
<#41 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4W6EMRNZGMV6PXMDEINQ3TWNCI3FANCNFSM6AAAAAAQCSC3EQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Sent from Gmail Mobile
|
Ah, that's a bit hard to determine @shaggy2626. Hopefully, they tell either on the resy page or on their main page. If not, you kind of have to sporadically check yourself. Usually, it's on the hour anywhere from 9 AM to 12 PM so there are not that many options to try. |
Maybe I'll add a tips section to the readme since a lot of people struggle with this. Been busy with other things so I'll come around to it when I have time. |
@Alkaar are the time slots shown in log4j the same as viewing the site as a regular user? |
@shaggy2626 Not sure what you mean by "the same" but it's the same time slots, just in text form |
What I meant to say was, is there any benefit using debug to see the time slots or would it be the same data as if I went to resy.com directly and just typed in the restaurant to see available times, thank you. |
@shaggy2626 The benefit of debug is you see exactly what time slots that are available that the bot will try to snipe and it's exactly when the reservations become available. If you try it through the website, it will load not only the time slots but images and other code as well. So it is likely that the website will have different time slots than what the bot sees for some of the more popular restaurants. |
In order to do that do I need to remove the values from resDetails.res-time-types? i see a lot of data in the logs but what should I look for to see what slots are available, thank you once again. |
It works for me. If you want to perform the same test I did you can use any restaurant that always has ability and select further out date just so you don't get charged cancellation fees. On the first line put a time you for |
Venue ID is correct, on your previous screenshot the log didn't appear to throw out an error. Was wondering why you thought there was an error? |
@J-clouds Did you confirm your using the correct API key? Search the string authorization: ResyAPI api and you should see the key there. Then all the way on the right side of console look at the headers x-resy-auth-token: Make sure you token is correct Do you have a card stored on file? |
Ah you're totally right. The x-resy-auth-token was wrong. I originally had it right but I think they changed it on me. Has this happened to you before too? If so, I wonder how often this changes... |
I think 48 hours tops. So far my API key hasn't changed and I have been using the script for about 2 days now. The token changed once and i think it was a bit over 24 hours. |
Ah so you're saying that the token changes at most once every 48 hours? |
TBH I just started using the code this week and changed my token once. Are you familiar with this? #41 (comment) For example: Restaurant Casa cruz appears to only have reservations in the afternoon. Im trying to see if they have a perm block in their system for evening hours so i dont waste my time trying. I went into debug mode and saw a lot of data but wasnt sure where to look to see if that time slot is ever open. |
Gosh good question...I wish I could help but you're more advanced than me already. @Alkaar can you please help? |
There was a bit of back and forth so I'll try to answer all the questions:
So resy actually sends back a lot of data, not just the time slots. If you dump it into some online JSON parser, it'll make it a bit more readable. To keep it simple though, look for anything starting with
When sniping your times with what's available, it will go through your priority list of times, one at a time. It will only snipe if there is a time on your priority list as well as a time available. The reason why it seems to not try at all is there is no overlap of your times with the times that are available. That is the reason why the bot error message is
This has happened to me but I don't know the frequency. I've had it last a week or upwards of many weeks. My hunch is it depends on when you login, logout, or reboot your computer but I haven't experimented enough to figure out what triggers it. |
@Alkaar Thank you for the response.
|
Sorry for the late response @shaggy2626. Been busy with the holidays but I replied to your questions below.
I've not considered this but that is a good suggestion. I have certainly been burned by this. I don't know if there's a way to validate the token so I'll have to dig into this.
I wasn't sure what your question was here. When sniping for two restaurants on the same day, what is the desired behavior you are looking for? |
[INFO ] 2023-01-21 09:00:13.457-05:00 ResyClient:130 - Headshot! Thank you Alkaar! |
Does anyone have any concerns if I close out this issue? Seems like it was mostly clarifying questions. |
This could be move to a new issue if you prefer to close this one, but the login API (http://subzerocbd.info/#using-email-and-password) requires the email/pass without the token and you can retrieve the token from the response. Also the token is a JWT with an expired attribute in Unix time. One idea could be to check for that expired time on the run of the bot and if expired either alert and don't schedule the task or even generate the login request (adding email/pass on config) and retrieve the new token. Thx for the bot Alkaar, it's great! |
Thanks for the reminder! I forgot about this ask. I didn't want to have e-mail/pass as an entry into the bot because people may not feel comfortable sharing that. Sharing a token that can expire feels "safer" IMO. I haven't looked into how to check if the token is still valid. @ngleich do you know where I can access the expiration of the token? Glad the bot has been useful! |
@Alkaar you on the payload part of the JWT they added the expiration day of the session. For example, if you go to https://jwt.io/ and copy the token, you will see on the payload section the expiration day. I don't have scala experience but it seems they offer a few libs to be able to do it https://jwt.io/libraries. Then you can use the timestamp to compare to current day. Having say that, now I believe that the expiration time of the payload might not be token expiration time, but the user session to keep logged on the page. I just checked my token on the config file from 2 weeks ago, with an expiration time of March 18th (so not expired), and is different from the current auth-token on the page. So this suggestion might be a misleading approach. |
Thanks for that info @ngleich! Good to know regardless. I was thinking the best way to check if the token is valid is to access say your profile page and if it loads correctly, your token is valid. If not, then the bot can prompt for a new token. Not sure if there's a cleaner approach. The expiration date would have been nicer if that was possible. |
@Alkaar not sure if this is the best place for this question, but since this seems like a general Q&A post I figured I'd add on here. I'm also trying to get a res at 4 Charles. Already in debug mode. I can't find any output that starts with I am getting the I also noticed a Traceback at the top of the debug logs, see below in the log dump. Any ideas? Logs:
and config (not including keys)
|
@theahura you don't see anything starting with 'rgs' because those are the available reservations. If you're doing it for 4 Charles, there are likely no available reservations. Try another restaurant that has available reservations and you will see rgs |
Tried a different restaurant, one that I know has availability pretty far out. Still no dice. When I am logged in on resy, I can see results.venues[0].slots has results. The equivalent http response when using the resy bot does not have any slots present, even though its for the exact same url, though the url params are a bit shuffled around. (Pinging @Alkaar since this may not be the right thread -- do you want me to make a different issue for this?) |
Request and response from the bot:
vs for the web version
|
Update: i'm an idiot, I set the config to look for dates in 2021 🤦 That said, fixing that particular issue resulted in the following traceback:
but I found this issue (#88) so that may help fix it. What is the right way to pass in no preferences if not an empty list 🤔 |
Hey, I'm trying to test the bot out for a reservation in the future that's clearly available: The code runs and loops through the following sequence for 10 seconds before ultimately failing: [INFO ] 2023-07-01 19:24:17.665-04:00 ResyBookingWorkflow:18 - Taking the shot... I double checked that the API Key, Auth Token and Venue ID is correct. Not sure what's the issue here. Any Idea's for a desperate user haha Thanks |
A bit late to respond but glad you figured out your issue @theahura! Regarding your question below...
An empty list "technically" means your preference is set to no table types and no times. If you wanted everything, you would have to pass in every time preference. I could potentially make empty list assume no preference if this keeps coming up as an issue, but likely I will not be prioritizing it since there are more critical issues that need to be addressed (e.g. the user agent issue 👉 #120 (comment)) As for a place for general Q&A, I would suggest posting under discussions. I found a lot of issues that were being opened were not actually issues but general setup questions and I felt the GitHub discussions were a better place to funnel those conversations. @jonnymona I would suggest you try again with the user agent fix that is mentioned in one of these issues as that is potentially what you were running into 👉 #120 (comment) Also, I'm going to close out this issue since the issue title is misleading and the conversation has deviated greatly from the original title. In terms of the bot getting beat out, IMO the bot is good enough while balancing usability. If the hit rate decreases in the future, I may revisit this topic. |
hey where are you accessing the api from? |
Everything appears to be working fine (I think...), but when it attempts to snipe the bot still keeps missing the shot. Not sure if I'm just going for too highly demanded reservations or if there's a way to speed it up.
Any advice or recommendations would be appreciated.
The text was updated successfully, but these errors were encountered: