How to Scrape Data from Airbnb Into A Google Sheet

In a couple months I’m turning 30 (woohoo :tada:), and to celebrate I don’t want to do anything crazy - just want a nice airbnb near the beach with my sisters, my partner, and my pup.

Finding the right airbnb is never simple though, and I wanted a way to easily compare several options and do some calculations on them. For instance, I wanted to be able to see what was the average cost per bed, and split that cost 4 ways. And while airbnb lets me create a list of properties in a group, it doesn’t easily calculate and show all that info for me.

I wanted to be able to have a google doc that organized each property in a row and let me add additional details for comparison, so I built an airbnb scraper with PixieBrix! Here’s how.

(If you prefer to watch, I created this video going through it.)

Step 1: Create your google sheet

First, create your google sheet where you want to feed the data.

Add the column headers that you want. Here’s what mine looked like :slight_smile:

Step 2: Head over to your PixieBrix page editor

Bring up a link to an airbnb property you want to scrape. Then right click on the page and select “inspect”, then head over to the PixieBrix section.

You might need to grant permission to Airbnb, but if you do, you’ll be prompted to do so as soon as you’re in the page editor.

Step 3: Add a button (or create a context menu)

I chose a button for this, but you could just as easily create a context menu (which shows up when you right click on a page, similarly to how you accessed the “Inspect” page).

Just click the big “Add” button in the top left. Call you button whatever you’d like, and then click the arrow to open up the selector. Choose a button that you want to copy its styles and inject a new button next to it. (I chose the “Share” button and gave it a “send” icon and placed it at the “Start” of the row. Assuming you want to do that, your settings should look like this.

Here’s what it looks like on the page
image

Step 4: Add the Jquery selector reader brick

Now we need to parse some info from the page to be able to send to our sheet. Thankfully this is really easy with the Jquery selector reader. All you need to do it click the arrow and select the element where the value you want appears.

For instance, I wanted to grab the name of the property, the total cost (not nightly cost), and beds. Here’s how I set this up :

Just use your selector to highlight over those areas and it will automatically grab those values for you so you don’t have to type them!

Now, we just need one more brick to map that to a row in Google Sheets.

Step 5: Add the “Add Google Sheets row” brick

Add this brick, connect your spreadsheet, and then just tell PixieBrix what data to map to which columns.

Here’s how I did it. Just grabbed the data brick and each variable into the header it goes into. Notice i called my Jquery brick output “data”, which is how I referenced @data.variable. I grabbed the URL from the input! (Automatically grabbed via the context menu.) Notice there were a few rows I didn’t map because it required a little more calculation that I couldn’t parse from the page, like how far a walk to the beach, and also my sister’s ranking :blush: - the most important piece that unfortunately PixieBrix can’t read her mind… yet.

And now watch it work!

When you click the button on an airbnb page, it will grab the text from the name, the price, and beds elements, as well as the URL of the and send that to your google sheet. Where you can sort or do whatever you want with it!

Bonus

Remember where I mentioned calculating the cost per bed and cost split amongst 4 people? You could easily do this with PixieBrix even though I did it in my spreadsheet, I realized after the fact I could have done it in PixieBrix by doing some math dividing the total cost by beds. But it’s a bit more complicated than that because you’d need to parse just the numbers from those (and I found it much faster to do that in a spreadsheet once and copy and paste the formula down).

1 Like

This is an amazing use case - thank you Britt!!
The addition of a button to do all the heavy lifting really changes the way we can use airbnb now!