• Faster Renting with AirSort

    by  • November 1, 2014 • Uncategorized

    Airbnb is awesome and super convenientĀ for booking a place to stay when traveling somewhere new. Unfortunately, just like other hotel booking sites, the price per night is never the actual price you end up paying. Hidden fees or additional charges are tacked on as you go to book your place and honestly, it’s annoying. NPR recently covered this and it was mentioned that even a couple cents off the price can make a customer choose a different chain over another. To be fair to Airbnb, their fees are mostly upfront and spelled out nicely, but still, why do I need to click the actual listing to see the complete price? AirSort fixes that problem and here’s how it works.

    AirSort is a chrome extension thatĀ takes the user’s search criteria, executes it, collects all total prices and then redisplays the search results by lowest total cost for the trip. When making the extension, I wanted to make the process as natural for the user as possible. In other words, I wanted the extension to literally feel like an extension of the Airbnb site. This meant respecting the search filters, loading processes and result tiles for each listing.

    For the technical aspects, it wasn’t terribly difficult to work with the Airbnb site. The first aspect to this process is to look at the general site structure and understand the important parts.

    Screen Shot 2014-11-01 at 2.09.55 PM

    Making notes of the main div containers wasn’t difficult and by playing around with the search filters, it was clear that the filters themselves persisted through the URL. This ends up working in our favor later on since Airbnb forces a second web request to get the actual pricing information later on. When viewing a single listing, you can get an idea of what I am talking about with the additional fees.

    Screen Shot 2014-11-01 at 2.12.27 PM

    Our interest lies in the “book it” box, but unfortunately, that’s loaded via javascript at the time of the page being requested. Not a problem, it just means theres a web request occurring within the page that needs to be tracked down. Reloading the page a few times and focusing on the network revealed the following.

    Screen Shot 2014-11-01 at 2.15.36 PM

    This web request back to the Airbnb servers gives us exactly what we want and includes a bonus — well structured JSON responses!

    Screen Shot 2014-11-01 at 2.17.34 PM

    The only slight issue is the “authenticity_token” included in the web request. Fortunately, Airbnb doesn’t do too much to hide this little piece of information and is nice enough to include within a hidden element inside the page.

    Screen Shot 2014-11-01 at 2.20.24 PM

    At this point, all the puzzle pieces are collected in order to make this work. Using the chrome extension features, we can easily take the URL from the browser, ship it off to my backend server and begin processing the results. In order to return data in a timely manner, only 3 pages (60 choices) of results are obtained and then crawled for their pricing information. This works better with 10 pages, but it’s a trade off between waiting without adding a lot more processing logic. The only tricky part of this process was preserving the tiles to display the results. As each result is crawled, the original tile HTML is extracted, it’s price modified and base64 encoded for easy transport.

    Screen Shot 2014-11-01 at 2.24.39 PM

     

    Screen Shot 2014-11-01 at 2.26.51 PM

    Once the results are returned, we simply use javascript to turn off the Airbnb loading, clear the existing results and populate the tiles inside of the display menu. The entire process occurs with a single click and the results display within a minute or so. The total time on this project was less than a days worth of work (thanks to Chrome) and has already saved me a bunch of time. My intention is to move the processing logic over to the Google App Engine, but until then, my server should remain up and functioning for those looking to check this out. Like any project, there’s a lot of potential for improvement, but this handles my needs perfectly.

    About