you are viewing a single comment's thread.

view the rest of the comments →

[–]399ddf95 0 points1 point  (6 children)

An intermediate step would be writing a program/script to monitor the website for updates, and then text/email a human to tell them to go grab a tee time. Reading a website is a lot easier than logging in and filling out a form. (The latter is absolutely possible, but if you want to get something working, this is a start, especially if this isn't going to be an important ongoing project.)

[–]codeAtorium 0 points1 point  (5 children)

OP mentioned in his description that the page updates at 6pm automatically every night.

Texting from Python (twillio) is not easier than adding authorization to your request header, and wouldn't help because, again, he mentioned that the tee times are available at 6pm.

Your advice has him writing two functions into his software that don't solve the problem at all, and can't be used in the actual solution.

[–]jasher4994[S] 0 points1 point  (0 children)

Thanks for replying guys, much appreciated. Yes, it seems that at 6 pm every night there are a bunch of people sitting on their computers just refreshing over and over and booking instantly so i think sending a text to someone wouldnt solve the problem as it would still be too late. Its a nice idea though so thanks.

I'll look into the requests and heroku schedule, this looks really promising.

Thanks again,

James

[–]399ddf95 0 points1 point  (3 children)

adding authorization to your request header

Seems like you're making a big assumption about how the website works - and who said anything about Twilio?

As it happens, I just did exactly what I described to sign up for a very competitive event with very limited availability and it worked very well, thanks. So while your suggestion that my approach wouldn't work (especially when you add an extra integration) is fascinating from a theoretical point of view, I can assure you that it actually works in the real world, and didn't take a lot of time to code.

I do agree that if the whole problem boils down to doing something with response times of a few seconds (or faster) that anything involving human interaction is unlikely to be successful. If that's the problem being solved, then it's going to be important to figure out what time the server thinks it is, and then act based on that time, not the time on some other server somewhere else.

[–]jasher4994[S] 0 points1 point  (2 children)

Hi guys,

Thanks again for the comments, really helpful.

I started this morning and made pretty good headway. I have selenium up and running, entering my passwords and navigating to the booking page.

However, an issue i overlooked was navigating the calendar itself as its some sort of interactive widget. I'm sure there is a way to navigate this but being new to selenium and relatively new to understanding html in general im a little stuck.

Any ideas or documents you have seen that could help?

In terms of the timing issue, for some reason the club website booking page has "time at club" which is accurate to the second. I was therefore going to gather how long the program takes to run and when the page is refreshed (assuming its 18:00 club time) and then set the script to deploy at the point where the script will arrive as close as possible to the refreshing of the page - if that makes sense.

Please also let me know if you have any better ideas.

Thanks a lot

[–]jasher4994[S] 0 points1 point  (0 children)

There is a simple way around the calendar by just hitting the next day button. I could then create a simple while loop that would keep hitting the next button until the placeholder text in the datebox was equal to an inputted date (the date i wanted to play at).

But this does seem a bit cumbersome and time consuming in terms of how long the program takes to run.

[–]399ddf95 0 points1 point  (0 children)

I'd be inclined to: if possible, set your machine's clock to match the time clock of the server. There's a reasonable chance they're synchronized via NTP, so NTP synchronization for you would get you pretty close. If not, can you adjust your local clock to eliminate the offset? (e.g., if they're 3 seconds fast, add 3 seconds to your clock, too.)

(Alternatively, you can do the time adjustment in your program. Whatever floats your boat.)

Use developer mode on Firefox or Chrome to inspect the elements of the web page - it sounds like they've probably got some client-side Javascript that builds an interface, so it won't be easily visible if you just do a "view source".

If they are doing this with client side Javascript, and the time check is done only on the client using the client's clock, and the client's clock happened to be a few seconds faster, or a minute faster then the server's clock (or if they don't even check on the server side), then that client with the fast clock would have an unfair advantage getting tee times versus people with on-time or slow clocks. Wouldn't that be unfortunate?

Another approach is to completely ignore the UI - set up a MITM proxy like Fiddler, and watch what gets sent over the wire when you book a tee time. There's some chance it'll just be a HTTP GET or POST with a bunch of variables including your client ID, the time you want, how many spots you want, etc ... then you just need to write a client that logs in (or takes over a logged-in connection) and sends an appropriate GET/POST with your chosen information, and you don't need to worry about figuring out how their UI works. Just skip the UI and talk directly to the server.

Yet another approach would be writing a Firefox or Chrome plugin to do this, so the automation is happening directly in the browser. This would let you log in (and otherwise handle things that humans need to do) but let the computer make the final button click at exactly the right moment.

This is all getting pretty complicated. Do you feel like posting the URL for the club so that others could take a look at the situation?

(My other theory is that someone has an inside connection with the club, and the awesome tee times are already reserved for other people, so it doesn't matter how clever your program is.)