Skip to content

Instantly share code, notes, and snippets.

@dslounge
Last active March 9, 2016 02:30
Show Gist options
  • Save dslounge/e7fd122896cec70944e3 to your computer and use it in GitHub Desktop.
Save dslounge/e7fd122896cec70944e3 to your computer and use it in GitHub Desktop.
Half-assed JS for copying AirBnB information into a google spreasheet
/*
Comparing AirBnB information and sharing it with your friends so you can decide where to stay is a pain in the ass.
When you're looking at an AirBnB listing, you can copy and paste this thing into the Chrome developer console to get basic information on your clipboard. You'll then be able to paste directly onto a google spreadsheet.
It copies:
- price per night
- total price
- name
- number of reviews
- star rating
- cover image
- url
I'm sure this could be turned into a bookmarklet. Did I mention it was half-assed?
*/
var listingPrice = $('.book-it__price-amount span').text();
var totalPrice = $('.book-it__subtotal table tr:last-child td:last-child span').text()
var name = $('#listing_name').text();
var imageUrl = $('.cover-img').css('background-image').replace('url(\"','').replace('\")', '');
var image = '=image("'+ imageUrl + '")';
var listingUrl = document.URL;
var reviewCount = $('.review-header-text h4 span').text().replace('()()', '').trim();
var starRating = $('.star-rating[itemprop]').attr('content');
var host = $('a.link-reset[href="#host-profile"]').text();
var hostReviews = $('.badge-pill-count').text()
var items = [listingPrice, totalPrice, name, image, reviewCount, starRating, host, hostReviews, listingUrl];
var toCopy = items.join('\t');
copy(toCopy);
@lloydmeta
Copy link

Cool !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment