Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One of my favorite spa/hotels for a weekend retreat for my wife and I has absurd waitlists — takes a few months typically to reserve 2 nights. However, they have a 7 day cancellation policy that leads to a U shaped availability curve for rooms.

The hotel website itself is inordinately difficult to search more than 1-2 nights (each day takes 6-8 clicks to search), but it’s all queryable through an undocumented API, so I wrote a small CLI tool in Crystal that can scan the next 60-90 days (configurable, of course) to see if there have been any sudden openings.

It does it all in parallel, so I can find out within about 10 seconds if there are any rooms available within a 30 (or longer) day range.

It’s already helped booked one wedding anniversary trip and one special getaway for 2 friends. I don’t use it often, but it’s wonderful to have around.



Reminds me of a similar hack I did recently. I wanted to book tickets for a show in Vegas, and for whatever reason the “ticket bundle” which included the show plus extras was about $20 cheaper than just the show on its own.

The only problem was selecting the bundle would automatically choose the seat (on the far side which weren’t good), skipping the seat selection modal.

I realized that if you had a seat in your cart, it would reserve it for 15 minutes and the bundle would pick the next available seat. Since I wanted central seats, I wrote a simple Puppeteer script which selected the bundle in multiple browser instances, reserving all the unwanted seats until mine was finally available.


> but it’s all queryable through an undocumented API

How did you go about querying this?


Mostly recording and replaying the network request logs through Chrome and comparing diffs as I clicked around, looking at headers and URL params generated from clicking to get a high level picture for how it all fit together.

They didn’t do anything fancy in terms of auth, etc, so the only thing that was challenging was guessing some additional parameters and formats for things like number of nights, etc., once I had the basic structure.

Once I had a basic search working, the rest of it was pretty straightforward. It works for other hotels that use this booking software as well, but I didn’t bother to go down that rabbit hole much further as I didn’t want to encourage adversarial techniques and I only need to use it a few times a year.


My guess is the developer tools. Maybe the web page makes you open a date dropdown for "check-in" > select check-in date, same for checkout, hit "search", and then a pop-up would open saying "sorry, nothing available", which you'd have to dismiss before repeating the process, but in the developer tools you might be a able to see that there's an XHR query which is just something like /searchAvailability?checkIn=20230313&checkOut=20230315/&guests=2, and OP's script could just modify the dates and hit this request URL.


Yep, pretty much this along with some guessing at the stuff that was obfuscated (mostly response structure and the meaning of some of the data).


REST APIs can be queried easily enough with curl or a gui like Postman. The more impressive bit is working out the API interface.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: