Last active
August 29, 2015 14:10
-
-
Save smj10j/a2f1b5e9faa550028874 to your computer and use it in GitHub Desktop.
Airbnb Availability Printed on DOM from JSON Response
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Requires jQuery | |
// Running from https://www.airbnb.com/rooms/4469705 works | |
// JSFiddle example of installing as a bookmarklet: http://jsfiddle.net/smj10j/sjwko4bp/ | |
var listingId = window.location.pathname.replace('/rooms/',''); | |
var calData = {}; | |
$.getJSON('https://www.airbnb.com/api/v1/listings/'+listingId+'/calendar?key=d306zoyjsyarp7ifhu67rjxn52tv0t20', function(data) { | |
calData = data.calendar; | |
calData.dates.forEach(function(date) { | |
$('body').append('<div>'+ | |
date.date + ' ' + | |
(date.price_local ? (date.price_local+'/night') : '') + | |
'</div>'); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment