Created
March 5, 2025 05:01
-
-
Save chernjie/7dcceac214bacf189b1d1697477bf4bf to your computer and use it in GitHub Desktop.
Airbnb Nightly Rate calculation
This file contains hidden or 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
// paste directly into browser console | |
var aa = $$('section [data-testid="hrd-sbui-payment-details-section"] > div > div > div') | |
.map(e => e.innerText.split('\n')) | |
.map(([a, b]) => [ | |
a.replace(/[^a-zA-Z]/gi, ''), | |
b && parseFloat(b.replace('$', '').replace(',', '').replace('−', '-')), | |
], | |
) | |
.reduce((last, e) => { last[e.shift()] = e.shift(); return last; }, {}); | |
var nights = parseInt($$('section [data-testid="hrd-sbui-payment-details-section"] > div > div > div > div') | |
.filter(e => e.innerText.includes('nights')) | |
.map(e => e.innerText) | |
.shift() | |
.split(' ')[2]); | |
[ | |
(aa.xnights + aa.Cleaningfee + aa.Guestservicefee + aa.Occupancytaxes)/nights, | |
(aa.nightsroomfee + aa.Cleaningfee + aa.Nightlyrateadjustment + aa.Hostservicefee)/nights, | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment